[rspec-users] RSpec 2 view specs: partial mocks

Michael Schuerig michael at schuerig.de
Sun Jun 20 16:19:55 EDT 2010

Are partial mocks supposed to work in rails-rspec 2.0.0.beta.12?

I'm trying to do things like


However, when I do that, the view uses its "ordinary" functionality, in 
particular, assigns are no longer available as instance variables.

Also, as regards mocking of partials (the rails ones)

    with(hash_including(:partial => "widget/row"))

does not work as expected when render is called with objects like this

  render @article
  render @articles

In these cases the hash[:partial] does not contain the path to the 
template, but the object(s).

I'm right now having little fun in beta hell. That's just how it is and 
by no means intend to distract you from your good work. I'm not yet 
reasonably familiar with Rails 3 and RSpec 2 and so I'm stumbling around 
alot in the sources and inch along in the debugger. One repeating point 
of bother is that often stacktraces are barely informative when 
delegation and dynamically generated code are in there. Unfortunately, I 
can't think of a way to improve on this.


Michael Schuerig
mailto:michael at schuerig.de

More information about the rspec-users mailing list