summaryrefslogtreecommitdiff
path: root/spec/controllers/application_controller_spec.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-04-09 21:46:58 -0600
committermo khan <mo@mokhan.ca>2014-04-09 21:46:58 -0600
commit15dc7e8f6af0afa05913eb3648a5b03c16b1db25 (patch)
treef1a9fa5869b9e88c2ab79ef75f8092061279c8ff /spec/controllers/application_controller_spec.rb
parent7476be24586b4fcea097efaf37c9543a1329a603 (diff)
load the current user.
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r--spec/controllers/application_controller_spec.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 60b9830..6ef6c9e 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -3,18 +3,24 @@ require "spec_helper"
describe ApplicationController do
controller do
def index
+ current_user
render text: 'hello'
end
end
context "when signed in" do
- let(:user_session) { Object.new }
+ let(:user) { User.create!(password: 'password', password_confirmation: 'password') }
+ let(:user_session) { Session.create!(user: user) }
+
+ before { get :index, {}, session_id: user_session.id }
it "lets you continue to do whatever the heck you were trying to do" do
- Session.stub(:find).with(1).and_return(user_session)
- get :index, {}, session_id: 1
response.status.should == 200
end
+
+ it "loads the current user" do
+ assigns(:current_user).should == user
+ end
end
context "when not signed in" do