From e5ed22843f93d26c383a92f696baf13e520e2f74 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Wed, 19 Sep 2012 13:28:24 +0200 Subject: [PATCH] fix profile endpoint spec --- spec/endpoint/profile_spec.rb | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/spec/endpoint/profile_spec.rb b/spec/endpoint/profile_spec.rb index 43c1f19e..612a8e9c 100644 --- a/spec/endpoint/profile_spec.rb +++ b/spec/endpoint/profile_spec.rb @@ -7,6 +7,7 @@ describe Travis::Api::App::Endpoint::Profile do before do User.stubs(:find_by_github_id).returns(user) User.stubs(:find).returns(user) + user.stubs(:repositories).returns(stub(administratable: stub(select: [repository]))) end it 'needs to be authenticated' do @@ -15,14 +16,26 @@ describe Travis::Api::App::Endpoint::Profile do it 'replies with the current user' do get('/profile', access_token: access_token.to_s).should be_ok - parsed_body["user"].should == { - "login" => user.login, - "name" => user.name, - "email" => user.email, - "gravatar_id" => user.gravatar_id, - "locale" => user.locale, - "is_syncing" => user.is_syncing, - "synced_at" => user.synced_at.strftime('%Y-%m-%dT%H:%M:%SZ') + parsed_body['user'].should == { + 'id' => user.id, + 'login' => user.login, + 'name' => user.name, + 'email' => user.email, + 'gravatar_id' => user.gravatar_id, + 'locale' => user.locale, + 'is_syncing' => user.is_syncing, + 'synced_at' => user.synced_at.strftime('%Y-%m-%dT%H:%M:%SZ') } end + + it 'includes accounts' do + get('/profile', access_token: access_token.to_s).should be_ok + parsed_body['accounts'].should == [{ + 'id' => user.id, + 'login' => user.login, + 'name' => user.name, + 'type' => 'user', + 'reposCount' => nil + }] + end end