Add avatar_url to accounts
This commit is contained in:
parent
e8d6dfec60
commit
6d74c51e0e
|
@ -21,13 +21,17 @@ module Travis
|
|||
private
|
||||
|
||||
def account_data(account)
|
||||
{
|
||||
data = {
|
||||
'id' => account.id,
|
||||
'name' => account.name,
|
||||
'login' => account.login,
|
||||
'type' => account.type.underscore,
|
||||
'repos_count' => account.repos_count
|
||||
}
|
||||
|
||||
data['avatar_url'] = account.avatar_url if account.respond_to?(:avatar_url)
|
||||
|
||||
data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,15 +4,15 @@ describe Travis::Api::V2::Http::Accounts do
|
|||
include Travis::Testing::Stubs, Support::Formats
|
||||
|
||||
let(:user) { { 'id' => 1, 'type' => 'User', 'login' => 'sven', 'name' => 'Sven', 'repos_count' => 2 } }
|
||||
let(:org) { { 'id' => 1, 'type' => 'Organization', 'login' => 'travis', 'name' => 'Travis', 'repos_count' => 1 } }
|
||||
let(:org) { { 'id' => 1, 'type' => 'Organization', 'login' => 'travis', 'name' => 'Travis', 'repos_count' => 1, 'avatar_url' => 'https://example.org/avatar.png' } }
|
||||
|
||||
let(:accounts) { [Account.new(user), Account.new(org)] }
|
||||
let(:data) { Travis::Api::V2::Http::Accounts.new(accounts).data }
|
||||
|
||||
it 'accounts' do
|
||||
data[:accounts].should == [
|
||||
{ 'id' => 1, 'login' => 'sven', 'name' => 'Sven', 'type' => 'user', 'repos_count' => 2 },
|
||||
{ 'id' => 1, 'login' => 'travis', 'name' => 'Travis', 'type' => 'organization', 'repos_count' => 1 }
|
||||
{ 'id' => 1, 'login' => 'sven', 'name' => 'Sven', 'type' => 'user', 'repos_count' => 2, 'avatar_url' => nil },
|
||||
{ 'id' => 1, 'login' => 'travis', 'name' => 'Travis', 'type' => 'organization', 'repos_count' => 1, 'avatar_url' => 'https://example.org/avatar.png' }
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user