|
|
|
@ -18,7 +18,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for daily builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'daily', disable_by_build: false)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 1, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 1, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -26,7 +26,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for weekly builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'weekly', disable_by_build: false)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 7, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 7, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -34,7 +34,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for monthly builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'monthly', disable_by_build: false)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 31, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 31, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -55,7 +55,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'daily', disable_by_build: false)
|
|
|
|
|
cron_build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
push_build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'push')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 1, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 1, 16)
|
|
|
|
|
cron_build.destroy
|
|
|
|
|
push_build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
@ -65,7 +65,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'weekly', disable_by_build: false)
|
|
|
|
|
cron_build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
push_build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'push')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 7, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 7, 16)
|
|
|
|
|
cron_build.destroy
|
|
|
|
|
push_build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
@ -75,7 +75,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'monthly', disable_by_build: false)
|
|
|
|
|
cron_build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
push_build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'push')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 31, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 31, 16)
|
|
|
|
|
cron_build.destroy
|
|
|
|
|
push_build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
@ -96,7 +96,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for daily builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'daily', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'push')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 2, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 2, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -104,7 +104,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for weekly builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'weekly', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'push')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 14, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 14, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -112,7 +112,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for monthly builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'monthly', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'push')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 2, 29, 16) # it's a leap year :-D
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 2, 29, 16) # it's a leap year :-D
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -132,7 +132,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for daily builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'daily', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 1, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 1, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -140,7 +140,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for weekly builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'weekly', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 7, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 7, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -148,7 +148,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
it "for monthly builds" do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'monthly', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.new(2016, 1, 31, 16)
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.new(2016, 1, 31, 16)
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -171,7 +171,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'daily', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
Timecop.freeze(DateTime.new(2016, 1, 1, 19))
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.now
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.now
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -181,7 +181,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'daily', disable_by_build: false)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
Timecop.freeze(DateTime.new(2016, 1, 1, 19))
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.now
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.now
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -191,7 +191,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'weekly', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
Timecop.freeze(DateTime.new(2016, 1, 7, 19))
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.now
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.now
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -201,7 +201,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'weekly', disable_by_build: false)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
Timecop.freeze(DateTime.new(2016, 1, 7, 19))
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.now
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.now
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -211,7 +211,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'monthly', disable_by_build: true)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
Timecop.freeze(DateTime.new(2016, 1, 31, 19))
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.now
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.now
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
@ -221,7 +221,7 @@ describe Travis::API::V3::Models::Cron do
|
|
|
|
|
cron = Travis::API::V3::Models::Cron.create(branch_id: branch.id, interval: 'monthly', disable_by_build: false)
|
|
|
|
|
build = Travis::API::V3::Models::Build.create(:repository_id => repo.id, :branch_name => branch.name, :event_type => 'cron')
|
|
|
|
|
Timecop.freeze(DateTime.new(2016, 1, 31, 19))
|
|
|
|
|
expect(cron.next_build_time).to be == DateTime.now
|
|
|
|
|
expect(cron.next_enqueuing).to be == DateTime.now
|
|
|
|
|
build.destroy
|
|
|
|
|
cron.destroy
|
|
|
|
|
end
|
|
|
|
|