[mocha-developer] Mocking the rendering of a Rails template
Bryan Helmkamp
bhelmkamp at gmail.com
Tue Oct 17 16:32:29 EDT 2006
Hello all,
I'm having difficulty setting up mocks such that I can verify that
Rails was going to render the right template file (for example
new.rhtml) and stop Rails from performing the actual rendering.
After peeking at Rails' internals, I tried two techniques as illustrated here:
http://pastie.caboo.se/18197
Neither worked.
I think the first one failed because Rails doesn't setup
response.template to be an instance of ActionView::Base until after
the controller processing is called.
I have no idea what is going on with the second attempt. It's hitting
a mock, but I have no idea where that mock is coming from. Logically,
it probably is coming from the any_instance magic, but in that case it
should be expecting the render_file call. Thoughts?
What am I doing wrong in the second case? Is there another way I
could mock this?
Any help would be greatly appreciated.
-Bryan
--
http://www.MyCongress.org/ -- coming soon
More information about the mocha-developer
mailing list