fix profile endpoint spec
This commit is contained in:
parent
d708b79e13
commit
e5ed22843f
|
@ -7,6 +7,7 @@ describe Travis::Api::App::Endpoint::Profile do
|
||||||
before do
|
before do
|
||||||
User.stubs(:find_by_github_id).returns(user)
|
User.stubs(:find_by_github_id).returns(user)
|
||||||
User.stubs(:find).returns(user)
|
User.stubs(:find).returns(user)
|
||||||
|
user.stubs(:repositories).returns(stub(administratable: stub(select: [repository])))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'needs to be authenticated' do
|
it 'needs to be authenticated' do
|
||||||
|
@ -15,14 +16,26 @@ describe Travis::Api::App::Endpoint::Profile do
|
||||||
|
|
||||||
it 'replies with the current user' do
|
it 'replies with the current user' do
|
||||||
get('/profile', access_token: access_token.to_s).should be_ok
|
get('/profile', access_token: access_token.to_s).should be_ok
|
||||||
parsed_body["user"].should == {
|
parsed_body['user'].should == {
|
||||||
"login" => user.login,
|
'id' => user.id,
|
||||||
"name" => user.name,
|
'login' => user.login,
|
||||||
"email" => user.email,
|
'name' => user.name,
|
||||||
"gravatar_id" => user.gravatar_id,
|
'email' => user.email,
|
||||||
"locale" => user.locale,
|
'gravatar_id' => user.gravatar_id,
|
||||||
"is_syncing" => user.is_syncing,
|
'locale' => user.locale,
|
||||||
"synced_at" => user.synced_at.strftime('%Y-%m-%dT%H:%M:%SZ')
|
'is_syncing' => user.is_syncing,
|
||||||
|
'synced_at' => user.synced_at.strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
}
|
}
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user