Return channels for a user record

This commit is contained in:
Piotr Sarnacki 2015-06-18 15:28:02 +02:00
parent f8a3c4aa19
commit c001a4d830
2 changed files with 7 additions and 0 deletions

View File

@ -32,8 +32,13 @@ module Travis
'synced_at' => format_date(user.synced_at),
'correct_scopes' => user.correct_scopes?,
'created_at' => format_date(user.created_at),
'channels' => channels
}
end
def channels
["user-#{user.id}"] + user.repository_ids.map { |id| "repo-#{id}" }
end
end
end
end

View File

@ -3,6 +3,7 @@ require 'spec_helper'
describe Travis::Api::V2::Http::User do
include Travis::Testing::Stubs, Support::Formats
let(:user) { stub_user(repository_ids: [1, 4, 8]) }
let(:data) { Travis::Api::V2::Http::User.new(user).data }
it 'user' do
@ -17,6 +18,7 @@ describe Travis::Api::V2::Http::User do
'synced_at' => json_format_time(Time.now.utc - 1.hour),
'correct_scopes' => true,
'created_at' => json_format_time(Time.now.utc - 2.hours),
'channels' => ["user-1", "repo-1", "repo-4", "repo-8"]
}
end
end