Template.expect_render 'failure'

I keep having problems w/ expect_render, mainly that it doesn’t work as
advertised. I can put a template.expect_render(:partial => ‘this should
fail’) in a view spec and I get no failure. I have read the docs, I have
followed the threads (two, which never resolve the initial issue and
dissolve into some other discussion) without much explanation for what
I’m experiencing. This has manifested itself in both 1.1.3 and 1.1.2
releases. I do use mocha mocking. So as a last resort I turned that off
and expect_render still ‘fails silently’. (I’ve also seen the failure in
Rails 2.0.2 and 1.2.5 if that helps.

I’m at a loss at how to continue debugging the issue. Any suggestions?

Thanks,
Kevin

On Feb 8, 2008 9:23 AM, Kevin B. [email protected] wrote:

I keep having problems w/ expect_render, mainly that it doesn’t work as
advertised. I can put a template.expect_render(:partial => ‘this should
fail’) in a view spec and I get no failure. I have read the docs, I have
followed the threads (two, which never resolve the initial issue and
dissolve into some other discussion) without much explanation for what
I’m experiencing. This has manifested itself in both 1.1.3 and 1.1.2
releases. I do use mocha mocking. So as a last resort I turned that off
and expect_render still ‘fails silently’. (I’ve also seen the failure in
Rails 2.0.2 and 1.2.5 if that helps.

Code please.

On Feb 8, 2008 10:23 AM, Kevin B. [email protected] wrote:

I’m at a loss at how to continue debugging the issue. Any suggestions?

I threw this line in one of my view specs

template.expect_render(:partial => “fail”)

and it failed as it should.

If you can, please share your view spec.

Regards,
Craig

David C. wrote:

Code please.

I stand corrected. It is only not working for me when mocha is enabled.
I just stepped through four cases and detailed the view spec, view (that
is sometimes empty) and results.

This is running on OSX 10.4.11 with the following setup:
moonbook:~ barnekr$ gem list --local | grep “mocha|rspec|rails”
mocha (0.5.5, 0.5.3, 0.4.0, 0.3.2)
rails (2.0.2, 1.2.5, 1.2.3, 1.2.2, 1.2.1, 1.1.6)
rspec (1.1.3, 1.1.2, 1.0.8, 1.0.5)
moonbook:~ barnekr$ ruby -v
ruby 1.8.5 (2006-08-25) [i686-darwin8.8.1]

http://pastie.caboo.se/149337

Thanks again,
Kevin

p.s. I updated the mocha gem to 0.5.6 and no change to the cases listed
involving mocha.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs