[rspec-users] how to stub the :current_user and any methods associated with it
smingins at elctech.com
Sun Apr 13 16:50:25 EDT 2008
Looking at yr earlier post ...
Not sure why you are stubbing entries on the controller ... entries is
called on the current user ...
I tend to do this ...
@current_user = mock_model(User, :id => 1, :entries => [@entry])
On 13/04/2008, at 7:24 AM, newbie wrote:
> Hey Jarkko,
> Thanks for the feedback. I tried your suggestion and it doesn't seem
> to work.
> To quickly recap I'm just testing in my controller that this works
> def index
> @entries = current_user.entries
> describe "on the main page" do
> it "should show all the current entries for the user" do
> get :index
> assigns[:entries].should == @entries
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users