Re: [rspec-users] spec'ing helpers that use controller

2007-07-24 Thread Rick Tessner
ntroller > @controller > end > > before(:each) do > @controller = mock('controller') > end > > it "should blah blah" do > end > > end > ___ > rspec-users mailing list > rspec-

Re: [rspec-users] spec'ing helpers that use controller

2007-07-24 Thread Rick Tessner
Hi, On Tue, 2007-24-07 at 15:26 -0700, Courtenay wrote: > Does this work? > > ApplicationHelper.stub!(:controller).and_return mock('controller', > :controller_name => 'foo') Sadly, no. Same result: undefined local variable or method `controller' for [RSpec example]: # -- Ri

[rspec-users] spec'ing helpers that use controller

2007-07-24 Thread Rick Tessner
Hi all, I'm in the process of creating rspecs for my helpers. One of the helpers in app/helpers/application_helper.rb looks like this: def page_name @page_name || "Define @page_name in #{controller.controller_name}::#{controller.action_name}" end The rspec is s