Using: rspec 2.3 with rails3 I'm unable to stub out the current_user method in my helper, not sure what I'm doing wrong:
describe "link_to_current_user, When logged in" do it "should link to the given user" do helper.stub!(:current_user).and_return(@user) helper.should_receive(:user_profile_path).at_least(:once).and_return('/ user/profiles/1') helper.link_to_current_user.should have_selector("a[href='/user/ profiles/1']") end end 7) UsersHelper link_to_current_user, When logged in should link to the given user Failure/Error: helper.link_to_current_user.should have_selector("a[href='/user/profiles/1']") undefined local variable or method `current_user' for #<ActionView::Base:0x4ab0884> # ./app/helpers/users_helper.rb:84:in `link_to_current_user' # ./spec/helpers/users_helper_spec.rb:89 and lines 83/84 from users_helper.rb: def link_to_current_user(options={}) if current_user _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users