With rspec-rails
3.0+测试设置分为spec_helper
和rails_helper
,我注意到生成的spec_helper
不是require 'rspec/rails'
。RSpec 3.1与Zeus,我应该在spec_helper中需要'rspec/rails'吗?
这使宙斯崩溃:
spec_helper.rb:5:in `<top (required)>': undefined method `configure' for RSpec:Module (NoMethodError)
到this issue最常见的回答是require 'rspec/rails'
。
但是,这不会击败拆分钢轨规格和PORO规格的全部目的,它只使用spec_helper
?或者,这是不是重要的,因为宙斯预先装载Rails呢?
我应该在spec_helper
这样做吗?
# Zeus does not preload RSpec
require 'rspec/core' unless defined? RSpec.configure
注意在生成的rails_helper
包含:
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
相关但不是http://stackoverflow.com/questions/25939918/guard-zeus-rspec-rails-undefined-method-configure-for-rspecmodule – max 2014-09-27 10:55:37
的副本另请参阅https:// github。com/burke/zeus/issues/474 – max 2014-11-07 18:39:42
我有同样的问题。但是我没有在spec_helper.rb中添加任何东西来修复它,你有没有设置警戒? – 2014-11-10 13:34:58