RSpec version: 2.4.0
I've defined method in ApplicationController, which is called via a before_filter.
I then added the following to spec_helper.rb:
RSpec.configure do |config|
config.before(:each, :type => :controller) do
Every spec example throws the following:
FAn expectation of :method was set on nil. Called from spec/spec_helper.rb:75:in `block (2 levels) in <top (required)>'. Use allow_message_expectations_on_nil to disable warnings.
This leads me to conclude that controller is nil in global before(:each, :type => :controller) hooks.
before(:each, :type => :controller)
Still seems to happen in RSpec 2.5.1 as well.
Observed in RSpec 2.6.3
This is not going to be fixed in rspec-rails-1.x as it would require some re-architecting.
See rspec/rspec-rails#391 for info on same issue in rspec-rails-2.
David, thanks for the feedback. I'll be watching the issue in rspec-rails-2 more closely. wdso thank you for re-opening this issue in the appropriate place.