On Jun 22, 2010, at 10:06 AM, David Chelimsky wrote: > > On Jun 22, 2010, at 9:58 AM, Michael Schuerig wrote: > >> On Tuesday 22 June 2010, David Chelimsky wrote: >>> On Jun 22, 2010, at 8:27 AM, Michael Schuerig wrote: >> >>>> #_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. >> >> It is. If I put all the assign(:x, value) before I first access #view, >> everything works as expected. The problem I had is entirely unrelated to >> stubs. > > Well, to be fair, the initial problem you cited in this thread (even in the > subject line) is "partial mocks", not "assigns." > > That said, yes, this is a bug. I'll see if we can do something about that in > Rails proper rather than rspec, which is just decorating the rails behavior.
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4931 > > Cheers, > David > >> It's just that when I do things in this order >> >> view.stub(:something).and_return('foo') >> assign(:bar, 10) >> >> The assign doesn't have an effect. I might as well have >> >> view.flash[:notice] = 'Something is rotten.' >> assign(:bar, 10) >> >> and the effect would be the same. Assigns that come after the view is >> first initialized are ignored. > > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users