Merge branch 'master' into jc-v3-env-vars

This commit is contained in:
Renée Hendricksen 2016-07-14 19:57:40 -04:00 committed by GitHub
commit 652439226a
3 changed files with 15 additions and 6 deletions

View File

@ -91,3 +91,12 @@ RSpec.configure do |c|
end end
end end
end end
require 'timecop'
Timecop.freeze(Time.now.utc)
describe Time do
let(:time) { Time.now.utc }
example { expect(Time.now.utc).to eq(time) }
example { expect(Time.now.utc + 5.minutes ).to eq(time + 5.minutes) }
end

View File

@ -2,6 +2,7 @@ describe Travis::Api::Serialize::V2::Http::Jobs do
include Travis::Testing::Stubs, Support::Formats include Travis::Testing::Stubs, Support::Formats
let(:data) { described_class.new([test]).data } let(:data) { described_class.new([test]).data }
let!(:time) { Time.now.utc }
it 'jobs' do it 'jobs' do
data['jobs'].first.should == { data['jobs'].first.should == {
@ -13,8 +14,8 @@ describe Travis::Api::Serialize::V2::Http::Jobs do
'log_id' => 1, 'log_id' => 1,
'number' => '2.1', 'number' => '2.1',
'state' => 'passed', 'state' => 'passed',
'started_at' => json_format_time(Time.now.utc - 1.minute), 'started_at' => json_format_time(time - 1.minute),
'finished_at' => json_format_time(Time.now.utc), 'finished_at' => json_format_time(time),
'config' => { 'rvm' => '1.8.7', 'gemfile' => 'test/Gemfile.rails-2.3.x' }, 'config' => { 'rvm' => '1.8.7', 'gemfile' => 'test/Gemfile.rails-2.3.x' },
'queue' => 'builds.linux', 'queue' => 'builds.linux',
'allow_failure' => false, 'allow_failure' => false,
@ -28,7 +29,7 @@ describe Travis::Api::Serialize::V2::Http::Jobs do
'sha' => '62aae5f70ceee39123ef', 'sha' => '62aae5f70ceee39123ef',
'branch' => 'master', 'branch' => 'master',
'message' => 'the commit message', 'message' => 'the commit message',
'committed_at' => json_format_time(Time.now.utc - 1.hour), 'committed_at' => json_format_time(time - 1.hour),
'committer_name' => 'Sven Fuchs', 'committer_name' => 'Sven Fuchs',
'committer_email' => 'svenfuchs@artweb-design.de', 'committer_email' => 'svenfuchs@artweb-design.de',
'author_name' => 'Sven Fuchs', 'author_name' => 'Sven Fuchs',
@ -50,4 +51,3 @@ describe Travis::Api::Serialize::V2::Http::Jobs, 'using Travis::Services::Jobs::
lambda { data }.should issue_queries(4) lambda { data }.should issue_queries(4)
end end
end end

View File

@ -1,5 +1,3 @@
require 'timecop'
describe Travis::API::V3::Models::Cron do describe Travis::API::V3::Models::Cron do
let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first }
let(:branch) { Travis::API::V3::Models::Branch.create(repository: repo, name: 'cron test') } let(:branch) { Travis::API::V3::Models::Branch.create(repository: repo, name: 'cron test') }
@ -7,11 +5,13 @@ describe Travis::API::V3::Models::Cron do
describe "next build time is calculated correctly on year changes" do describe "next build time is calculated correctly on year changes" do
before do before do
Timecop.return
Timecop.travel(DateTime.new(2015, 12, 31, 16)) Timecop.travel(DateTime.new(2015, 12, 31, 16))
end end
after do after do
Timecop.return Timecop.return
Timecop.freeze(Time.now.utc)
end end
it "for daily builds" do it "for daily builds" do