[rspec-users] [Rails] Controller testing problem
matt at mattwynne.net
Wed Jul 1 12:55:17 EDT 2009
On 1 Jul 2009, at 12:48, Fernando Perez wrote:
>> Is there a way for RSpec to skip the filters in tests? Or to stop
>> ApplicationController to derive from SiteController?
> That's a perfect use case for mocks and/or stubs.
Indeed. Another way to do this is to test a special subclass of
SiteController, which overrides those methods that are called by the
before_filters and makes them do what you want for the test (i.e.
probably very little).
See Michael Feathers' excellent book 'Working Effectively with Legacy
Code' for more inspiration and ideas in wrestling with a codebase that
has no existing tests.
More information about the rspec-users