views:

14

answers:

0

I have this in my spec_helpers.rb file:

config.before(:each, :type => :view) do
  @widget = Factory(:widget)
  view.stub!(:widget => @widget)
end

@widget is accessible in my views, but the view.stub! part returns:

undefined method `_routes' for nil:NilClass
/Users/mdarby/.rvm/gems/[email protected]/gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in `method_missing'
/Users/mdarby/.rvm/gems/[email protected]/gems/actionpack-3.0.0/lib/action_view/test_case.rb:154:in `view'
/Users/mdarby/.rvm/gems/[email protected]/gems/rspec-rails-2.0.0/lib/rspec/rails/example/view_example_group.rb:85:in `view'
/Users/mdarby/Documents/Apps/dynamixccw.com/spec/spec_helper.rb:39:in `block (3 levels) in '

In RSpec2/Rails2, this line would have read template.stub!(:widget => @widget) and worked as expected.

The question is, what should I be using instead of view, or am I using it incorrectly?