HiI like using before_filter in controllers to dry up code. From what I have read I understand that this is not something everyone agrees upon. Never mind.
I was looking for a way in my controller spec's to basically 1. assert that I have applied the before_filter on the actions I want and 2. execute the before_filter if it is defined in that controller and assert that it is doing as it should. To me that seems to be the specific behaviour I am after.
I really only wanted to do this in one place ... and not have to "share" it anywhere. Also I wanted to do a little more than some of the solutions I found.
Anyways ... I ended up with a spec description like this: http://pastie.org/317459And then in the rest of the spec I can stub the before_filter methods like here http://www.caboo.se/articles/2007/8/24/skinny-controllers-skinnier-controller-specs
So just wondered any thoughts ... have you seen anything else around? The code behind it at the moment is quite trivial and will probably grow if I have other filter types. I can post a better write up if this sounds like something useful for others.
There is this matcher: http://github.com/ngty/have_filter/tree/ master .... but again, it wasn't quite what I felt I wanted.
Cheers Shane
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users