我对Bundler Gemfile选项一般都很清楚,但我不确定为什么rspec(特别是rspec-rails)应该同时用于测试和开发。
以下是我的测试分组:
group :development, :test do
gem 'rspec-rails'
gem 'faker'
end
group :test do
gem "factory_girl_rails"
gem "capybara"
gem 'guard-rspec'
gem 'rb-fsevent'
gem 'growl'
end
这看起来不错吗?
答案 0 :(得分:28)
我引用了the official documentation:
将rspec-rails添加到Gemfile中的:test和:development groups:
group :test, :development do
gem "rspec-rails", "~> 2.6"
end
它需要在:development组中公开生成器和rake 任务,而无需键入RAILS_ENV = test。