Hi, (This is my first post after months of appreciative lurking...)
I'm trying to spec the following conditional controller macro: class ApplicationController < ActionController::Base # turn off session management for robots session :off, :if => lambda {|req| req.user_agent =~ /(Google|Slurp)/i } # ... end My current attempt seems to be quite unsuccessful: 1) when I include the controller.should_receive(:session) statement, the index action no longer seems to be actually called (ie a breakpoint placed in the index method is not triggered) 2) I receive the following error: Spec::Mocks::MockExpectationError in 'ApplicationController should turn off session management for requests made by robot user agent' Mock 'FooController' expected :session with (:off) but received it with (no args) ./spec/controllers/application_spec.rb:19: Any suggestions? Thanks much, Matt describe ApplicationController do class FooController < ApplicationController def index; render :text => "foo"; end end controller_name :foo it "should turn off session management for requests made by robot user agent" do request.stub!(:user_agent).and_return("Google Robot") controller.should_receive(:session).with(:off) get :index end end -- View this message in context: http://www.nabble.com/Spec%27ing-controller-macros-tp16927457p16927457.html Sent from the rspec-users mailing list archive at Nabble.com. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users