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.

cheers,
Matt Wynne

http://mattwynne.net
+447974 430184

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to