From 383d233d9e979742300a6e0033c3d0461c6c4b38 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 2 Aug 2013 13:18:54 +0200 Subject: [PATCH] Add missing spec for UserManager (when drop_token is true) --- .../endpoint/authorization/user_manager_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/unit/endpoint/authorization/user_manager_spec.rb b/spec/unit/endpoint/authorization/user_manager_spec.rb index f8067cd0..d55c68fb 100644 --- a/spec/unit/endpoint/authorization/user_manager_spec.rb +++ b/spec/unit/endpoint/authorization/user_manager_spec.rb @@ -29,6 +29,19 @@ describe Travis::Api::App::Endpoint::Authorization::UserManager do { login: 'drogus', id: 456 }.stringify_keys } + it 'drops the token when drop_token is set to true' do + manager = described_class.new(data, 'abc123', true) + + user = stub('user', login: 'drogus', github_id: 456) + User.expects(:find_by_github_id).with(456).returns(user) + + attributes = { login: 'drogus', github_id: 456 }.stringify_keys + + user.expects(:update_attributes).with(attributes) + + manager.fetch.should == user + end + context 'with existing user' do it 'updates user data' do user = stub('user', login: 'drogus', github_id: 456)