Hi, I''m in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we''re now supposed to do view.stub!, but I can''t seem to get this to work on beta 10. I get an "undefined local variable or method `view'' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" error. I see that in this commit (http://github.com/rspec/rspec-rails/commit/ 0e860f580618045a34c17069b308c093e2e830cb) David removed the view method, but I can''t figure out what it was replaced with. Something in ActionView::TestCase::Behavior? I''m on rails 3.0.0.beta3. Any idea what I''m missing?
Hi, I''m in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we''re now supposed to do view.stub!, but I can''t seem to get this to work on beta 10. I get an "undefined local variable or method `view'' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" error. I see that in this commit (http://github.com/rspec/rspec-rails/commit/ 0e860f580618045a34c17069b308c093e2e830cb<http://github.com/rspec/rspec-rails/commit/ 0e860f580618045a34c17069b308c093e2e830cb>) David removed the view method, but I can''t figure out what it was replaced with. Something in ActionView::TestCase::Behavior? I''m on rails 3.0.0.beta3. Any idea what I''m missing? Thanks, Trey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100608/a3b20378/attachment.html>
Hi, I''m in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we''re now supposed to do view.stub!, but I can''t seem to get this to work on beta 10. I get an "undefined local variable or method `view'' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" error. I see that in this commit (http://github.com/rspec/rspec-rails/commit/ 0e860f580618045a34c17069b308c093e2e830cb<http://github.com/rspec/rspec-rails/commit/0e860f580618045a34c17069b308c093e2e830cb>) David removed the view method, but I can''t figure out what it was replaced with. Something in ActionView::TestCase::Behavior? I''m on rails 3.0.0.beta3. Any idea what I''m missing? Thanks, Trey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100608/7d7b2b10/attachment.html>
On Jun 8, 2010, at 10:26 AM, Trey Bean wrote:> Hi, > > I''m in the process of upgrading an app to Rails 3/Rspec 2. I see that > stubbing a view helper method has changed in Rspec 2. It looks like > instead of doing template.stub!, we''re now supposed to do view.stub!, > but I can''t seem to get this to work on beta 10. I get an "undefined > local variable or method `view'' for > #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" > error. > > I see that in this commit (http://github.com/rspec/rspec-rails/commit/ > 0e860f580618045a34c17069b308c093e2e830cb) David removed the view > method, but I can''t figure out what it was replaced with. Something > in ActionView::TestCase::Behavior? > > I''m on rails 3.0.0.beta3. > > Any idea what I''m missing?Please report this to http://github.com/rspec/rspec-rails/issues Thanks, David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100608/b1a77ae0/attachment-0001.html>
dchelimsky at gmail.com
2010-Jun-08 16:41 UTC
[rspec-users] How do I stub a view in rspec-2
On Jun 8, 12:15?pm, David Chelimsky <dchelim... at gmail.com> wrote:> On Jun 8, 2010, at 10:26 AM, Trey Bean wrote: > > > > > > > Hi, > > > I''m in the process of upgrading an app to Rails 3/Rspec 2. ?I see that > > stubbing a view helper method has changed in Rspec 2. ?It looks like > > instead of doing template.stub!, we''re now supposed to do view.stub!, > > but I can''t seem to get this to work on beta 10. ?I get an "undefined > > local variable or method `view'' for > > #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" > > error. > > > I see that in this commit (http://github.com/rspec/rspec-rails/commit/ > > 0e860f580618045a34c17069b308c093e2e830cb) David removed the view > > method, but I can''t figure out what it was replaced with. ?Something > > in ActionView::TestCase::Behavior? > > > I''m on rails 3.0.0.beta3. > > > Any idea what I''m missing? > > Please report this tohttp://github.com/rspec/rspec-rails/issuesNevermind - I''ve already got it entered and fix on the way: http://github.com/rspec/rspec-rails/issues/issue/73
Thanks David! On Tue, Jun 8, 2010 at 10:41 AM, dchelimsky at gmail.com <dchelimsky at gmail.com>wrote:> > > On Jun 8, 12:15 pm, David Chelimsky <dchelim... at gmail.com> wrote: > > On Jun 8, 2010, at 10:26 AM, Trey Bean wrote: > > > > > > > > > > > > > Hi, > > > > > I''m in the process of upgrading an app to Rails 3/Rspec 2. I see that > > > stubbing a view helper method has changed in Rspec 2. It looks like > > > instead of doing template.stub!, we''re now supposed to do view.stub!, > > > but I can''t seem to get this to work on beta 10. I get an "undefined > > > local variable or method `view'' for > > > #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" > > > error. > > > > > I see that in this commit (http://github.com/rspec/rspec-rails/commit/ > > > 0e860f580618045a34c17069b308c093e2e830cb) David removed the view > > > method, but I can''t figure out what it was replaced with. Something > > > in ActionView::TestCase::Behavior? > > > > > I''m on rails 3.0.0.beta3. > > > > > Any idea what I''m missing? > > > > Please report this tohttp://github.com/rspec/rspec-rails/issues > > Nevermind - I''ve already got it entered and fix on the way: > > http://github.com/rspec/rspec-rails/issues/issue/73 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100608/78ffbf68/attachment.html>
On Sat, Jun 5, 2010 at 8:24 PM, Trey <trey at 12spokes.com> wrote:> Hi, > > I''m in the process of upgrading an app to Rails 3/Rspec 2. ?I see that > stubbing a view helper method has changed in Rspec 2. ?It looks like > instead of doing template.stub!, we''re now supposed to do view.stub!, > but I can''t seem to get this to work on beta 10. ?I get an "undefined > local variable or method `view'' for > #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" > error. > > I see that in this commit (http://github.com/rspec/rspec-rails/commit/ > 0e860f580618045a34c17069b308c093e2e830cb) David removed the view > method, but I can''t figure out what it was replaced with. ?Something > in ActionView::TestCase::Behavior? > > I''m on rails 3.0.0.beta3. > > Any idea what I''m missing?This was an omission from beta.10/11 that I just fixed last night and will be updated in beta.12. Short term fix (could be in spec_helper.rb) module ViewMemoizationFix def _view @_view ||= view end alias_method :view, :_view end RSpec.configure do |c| c.include ViewMemoizationFix, :example_group => { :file_path => /\bspec\/views\// } end Let us know if that doesn''t work. Cheers, David
I''ve been using edge since your commit (and rails 3 beta 4) and it''s working great. Thanks! On Wed, Jun 9, 2010 at 6:56 AM, David Chelimsky <dchelimsky at gmail.com>wrote:> On Sat, Jun 5, 2010 at 8:24 PM, Trey <trey at 12spokes.com> wrote: > > Hi, > > > > I''m in the process of upgrading an app to Rails 3/Rspec 2. I see that > > stubbing a view helper method has changed in Rspec 2. It looks like > > instead of doing template.stub!, we''re now supposed to do view.stub!, > > but I can''t seem to get this to work on beta 10. I get an "undefined > > local variable or method `view'' for > > #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0>" > > error. > > > > I see that in this commit (http://github.com/rspec/rspec-rails/commit/ > > 0e860f580618045a34c17069b308c093e2e830cb) David removed the view > > method, but I can''t figure out what it was replaced with. Something > > in ActionView::TestCase::Behavior? > > > > I''m on rails 3.0.0.beta3. > > > > Any idea what I''m missing? > > This was an omission from beta.10/11 that I just fixed last night and > will be updated in beta.12. > > Short term fix (could be in spec_helper.rb) > > module ViewMemoizationFix > def _view > @_view ||= view > end > alias_method :view, :_view > end > > RSpec.configure do |c| > c.include ViewMemoizationFix, :example_group => { :file_path => > /\bspec\/views\// } > end > > Let us know if that doesn''t work. > > Cheers, > David > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To post to this group, send email to rspec at googlegroups.com. > To unsubscribe from this group, send email to > rspec+unsubscribe at googlegroups.com <rspec%2Bunsubscribe at googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/rspec?hl=en. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100609/23deb396/attachment.html>