How can I verify that when an action in the controller is available, this before_filter controller will be executed?
The before_filter test is tested in a separate group of examples, so there is no need to duplicate tests for all actions that depend on the before_filter file.
If i have
controller.should_receive(:my_before_filter)
in my example, it works fine. However, the presence of the above expectation, apparently, leads to the fact that the logic is my_before_filternot executed (it should assign an instance variable).
How to overcome this limitation or mock the behavior of my_before_filter (it sets the instance variable on the controller)? Or is there a better way to do this?
As it’s clear now, I did all this wrong, I would still like to know how to make fun of the before_filter behavior that sets the instance variable. Of course, this should be possible to do in the controller specification?
source
share