开发者

How do I stub a view in rspec-2

开发者 https://www.devze.com 2023-01-02 16:14 出处:网络
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

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 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 turned out to be a bug in rspec-rails after moving more of the functionality back to ActionView::TestCase::Behavior. David re-exposed _view as view, so view.stub! is still the way to go. It was just temporarily broken.

0

精彩评论

暂无评论...
验证码 换一张
取 消