From 97d0eaef7bc25b8ff38f142310419b081dbaac56 Mon Sep 17 00:00:00 2001 From: Christian Rijke Date: Fri, 19 Jul 2013 17:46:50 +0200 Subject: [PATCH] Stub the 'logged?' method for users, as the application_controller calls it during test. --- spec/controllers/principal_roles_controller_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/controllers/principal_roles_controller_spec.rb b/spec/controllers/principal_roles_controller_spec.rb index 99143d7301..94f87485ee 100644 --- a/spec/controllers/principal_roles_controller_spec.rb +++ b/spec/controllers/principal_roles_controller_spec.rb @@ -40,6 +40,7 @@ describe PrincipalRolesController do PrincipalRole.stub!(:new).and_return(@principal_role) @user = mock_model User @user.stub!(:valid?).and_return(true) + @user.stub!(:logged?).and_return(true) Principal.stub!(:find).and_return(@user) @principal_role.stub!(:role=) @principal_role.stub!(:role).and_return(@global_role) @@ -120,7 +121,9 @@ describe PrincipalRolesController do describe :delete do before :each do @principal_role.stub!(:principal_id).and_return(1) - Principal.stub(:find).and_return(mock_model User) + @user = mock_model User + @user.stub!(:logged?).and_return(true) + Principal.stub(:find).and_return(@user) @principal_role.stub!(:destroy) @params = {"id" => "1"} end