On 27 May 2008, at 01:22, Tim Glen wrote:
  whiz_banger = Object.new
  whiz_banger.extend WhizBangModule
I like that as far as it goes, but I'm wondering if there's a way to take it one step further and actually have it extend the typical controller functionality - some of my methods make use of the session, or set some assigns, for instance. I'd love to be able to test it as if it were in a controller already

I suspect that the conventional answer is to mock the pieces of "typical controller functionality" you're relying on, so that 1. you're speccing your module in isolation from any other code, instead of trying to exercise two things at once, and 2. you're explicitly specifying (and exercising) the interface between your module and its host class instead of making a whole bunch of invisible assumptions.

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

Reply via email to