Reputation: 41
Hi I am trying to stub an around_filter method in controller which return true always,using the below source code in rspec
before(:each) do
controller.stub(:catch_exceptions).and_return(true)
end
after(:each) do
controller.stub(:catch_exceptions).and_return(true)
end
but it fails. When i change that particular method as before_filter then it works fine? can anyone help me plz?
Upvotes: 0
Views: 276
Reputation: 37419
To correctly stub an around_filter
, you should yield
for the rest of the operation to work, otherwise, you are simply stubbing the whole action...
controller.stub(:catch_exceptions).and_yield
Upvotes: 2