travis-api/spec/unit/api/v2/http/branch_spec.rb

41 lines
1.3 KiB
Ruby

require 'spec_helper'
describe Travis::Api::V2::Http::Branch do
include Travis::Testing::Stubs, Support::Formats
let(:data) { Travis::Api::V2::Http::Branch.new(branch).data }
let(:branch) { build }
specify 'branch' do
data['branch'].should be == {
'id' => 1,
'repository_id' => 1,
'commit_id' => 1,
'job_ids' => [1, 2],
'number' => 2,
'config' => { 'rvm' => ['1.8.7', '1.9.2'], 'gemfile' => ['test/Gemfile.rails-2.3.x', 'test/Gemfile.rails-3.0.x'] },
'state' => 'passed',
'started_at' => json_format_time(Time.now.utc - 1.minute),
'finished_at' => json_format_time(Time.now.utc),
'duration' => 60,
'pull_request' => false
}
end
specify 'commit' do
data['commit'].should be == {
'id' => 1,
'sha' => '62aae5f70ceee39123ef',
'branch' => 'master',
'message' => 'the commit message',
'compare_url' => 'https://github.com/svenfuchs/minimal/compare/master...develop',
'committed_at' => json_format_time(Time.now.utc - 1.hour),
'committer_email' => 'svenfuchs@artweb-design.de',
'committer_name' => 'Sven Fuchs',
'author_name' => 'Sven Fuchs',
'author_email' => 'svenfuchs@artweb-design.de',
'compare_url' => 'https://github.com/svenfuchs/minimal/compare/master...develop',
}
end
end