Helper spec problems

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

  1. 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

On Thu, Dec 30, 2010 at 3:02 PM, klochner [email protected] wrote:

user/profiles/1’)
#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

I’m guessing this is the same issue as
http://groups.google.com/group/rspec/browse_thread/thread/db5a43ee63157768,
yes?