[rspec-users] RSpec 2 view specs: partial mocks
dchelimsky at gmail.com
Tue Jun 22 09:58:09 EDT 2010
On Jun 22, 2010, at 8:27 AM, Michael Schuerig wrote:
> On Sunday 20 June 2010, Michael Schuerig wrote:
>> 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
> I've found the reason:
> def _view
> @_view ||= begin
> view = ActionView::Base.new(ActionController::Base.view_paths,
> _assigns, @controller)
> #_view (and #view in turn) creates just one ActionView::Base instance
> the first time it is called. That's as it is intended. The effect is,
> however, that only assigns up to that point are passed to that instance.
> Consequently, later assigns are ignored.
Stubs and assigns are unrelated, so even though this might be a bug, I don't think it's the cause of what you're seeing.
More information about the rspec-users