jonleighton / focused_controller

MIT License
468 stars 27 forks source link

Filters are ignored in tests #2

Closed eugenebolshakov closed 12 years ago

eugenebolshakov commented 12 years ago

It happens because the req method simply calls the controller's run method: https://github.com/jonleighton/focused_controller/blob/master/lib/focused_controller/test_helper.rb#L117

jonleighton commented 12 years ago

This is deliberate :)

The point is that it's unit-testing. Therefore you only want to test one method at a time.

Also, a lot of the time filters are redundant, because you can just used normal OOP methods of sharing code. E.g. rather than putting a before_filter in front a bunch of actions, create a common superclass and call super in the method.