I have a lot of controllers with virtually identical functionality for most actions. I've been using shared behaviours to DRY things up a bit, but I still have to create separate behaviours for each context before I can use the shared behaviours
what I have now is a generic file which contains all the behaviours and examples common to all the controllers, and that file gets loaded from an actual controller spec. The generic file knows which controller to test by calling kontroller(), which is defined in the controller spec. here's a very simplified example: http://pastebin.com/m6b47bae9 It works great when I run the specs individually, but when I use rake, specs begin to fail and i think it's because the value of kontroller() is set to whatever it returns the first time it gets called. Here's the rake output from running the specs shown above: FooController .FooController . Finished in 0.041793 seconds 2 examples, 0 failures I would expect it to print FooController and then BarController ... interestingly, if I insert 'puts kontroller.to_s' *outside* of the describe block, then it does output the names of both controllers as expected. does anyone know of a solution? thanks dave -- View this message in context: http://www.nabble.com/reusable-specs---almost-there-tf4216708.html#a11996399 Sent from the rspec-users mailing list archive at Nabble.com. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users