最近看了 使用 RSpec 测试 Rails 程序 ,实践了一番。分享下测试 gem 的集合
group :development, :test do
gem 'awesome_print', require: false
gem 'brakeman', require: false
gem 'rails_best_practices', require: false
gem 'rubocop', require: false
gem 'better_errors'
gem 'guard-rspec', require: false # 自动化测试
# gem 'spring-commands-rspec' # 加速测试
# gem 'email_spec' # email测试
# gem 'timecop' # 时间冻结,rails4.1后activesupport有提供
gem 'simplecov', require: false # 测试覆盖率
# for test
gem 'rspec-rails' # rspec
gem 'factory_girl_rails' # 测试数据
gem 'database_cleaner' # 清理测试数据库
end
group :development do
# 部署
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem 'capistrano-bundler'
end
group :test do
gem 'shoulda' # 测试model,非常省代码
gem 'capybara' # 功能/feature测试
gem 'poltergeist' # capybara phantomjs driver
gem 'selenium-webdriver' # capybara selenium driver 打开firefox进行测试,速度慢
gem 'capybara-screenshot' # 测试截图
gem 'show_me_the_cookies' # 主要是在功能测试过程中操作cookie,例如显示cookie
gem 'launchy' # 启动浏览器
gem 'ffaker' # 生成假数据,faker重构版本
end