With rspec-rails
3.0+ the test setup is split into spec_helper
and rails_helper
and I noticed that the generated spec_helper
does not require 'rspec/rails'
.
This causes zeus to crash:
spec_helper.rb:5:in `<top (required)>': undefined method `configure' for RSpec:Module (NoMethodError)
The most common response to this issue is to require 'rspec/rails'
.
But won´t this defeat the whole purpose of splitting rails specs and PORO specs which just use the spec_helper
? Or does this not matter since Zeus preloads Rails anyways?
Should I do something like this in my spec_helper
?
# Zeus does not preload RSpec
require 'rspec/core' unless defined? RSpec.configure
Note that in the generated rails_helper
contains:
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!
gem 'guard-rspec'
add this to gemfile, This might be little strange, But I was able to reproduce it and then it got fixed after adding this. There is a somekind of dependency. which is trying to access Rspec before its loaded – Counterinsurgency