Are partial mocks supposed to work in rails-rspec 2.0.0.beta.12?
I’m trying to do things like
view.stub(:current_user).and_return(@user)
view.stub(:current_page?).and_return(false)
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)
view.should_receive(:_render_partial).
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
–
Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/