summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-01 02:02:26 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 23:46:58 +0900
commit57d082f3589060c90c2841dd52dda77574f5d984 (patch)
treeddf11a4ccffd21c0976273077a848d8488b393ff /spec
parent21cabf381b55ab2747d773ae1eeb70d2bb40e9a5 (diff)
downloadgitlab-ce-57d082f3589060c90c2841dd52dda77574f5d984.tar.gz
Add validator
Diffstat (limited to 'spec')
-rw-r--r--spec/models/ci/trigger_schedule_spec.rb6
-rw-r--r--spec/workers/trigger_schedule_worker_spec.rb17
2 files changed, 2 insertions, 21 deletions
diff --git a/spec/models/ci/trigger_schedule_spec.rb b/spec/models/ci/trigger_schedule_spec.rb
index 6a586a4e9b1..30972f2295e 100644
--- a/spec/models/ci/trigger_schedule_spec.rb
+++ b/spec/models/ci/trigger_schedule_spec.rb
@@ -4,8 +4,6 @@ describe Ci::TriggerSchedule, models: true do
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:trigger) }
- # it { is_expected.to validate_presence_of :cron }
- # it { is_expected.to validate_presence_of :cron_time_zone }
it { is_expected.to respond_to :ref }
it 'should validate ref existence' do
@@ -26,7 +24,7 @@ describe Ci::TriggerSchedule, models: true do
context 'when every hour' do
let(:cron) { '0 * * * *' } # 00:00, 01:00, 02:00, ..., 23:00
- it 'fails' do
+ it 'gets an error' do
expect(trigger_schedule.errors[:cron].first).to include('can not be less than 1 hour')
end
end
@@ -34,7 +32,7 @@ describe Ci::TriggerSchedule, models: true do
context 'when each six hours' do
let(:cron) { '0 */6 * * *' } # 00:00, 06:00, 12:00, 18:00
- it 'succeeds' do
+ it 'gets no errors' do
expect(trigger_schedule.errors[:cron]).to be_empty
end
end
diff --git a/spec/workers/trigger_schedule_worker_spec.rb b/spec/workers/trigger_schedule_worker_spec.rb
index f0c7eeaedae..950f72a68d9 100644
--- a/spec/workers/trigger_schedule_worker_spec.rb
+++ b/spec/workers/trigger_schedule_worker_spec.rb
@@ -28,23 +28,6 @@ describe TriggerScheduleWorker do
end
end
- context 'when there is a scheduled trigger within next_run_at and a runnign pipeline' do
- let!(:trigger_schedule) { create(:ci_trigger_schedule, :cron_nightly_build, :force_triggable) }
-
- before do
- create(:ci_pipeline, project: trigger_schedule.project, ref: trigger_schedule.ref, status: 'running')
- worker.perform
- end
-
- it 'do not create a new pipeline' do
- expect(Ci::Pipeline.count).to eq(1)
- end
-
- it 'do not reschedule next_run_at' do
- expect(Ci::TriggerSchedule.last.next_run_at).to eq(trigger_schedule.next_run_at)
- end
- end
-
context 'when there are no scheduled triggers within next_run_at' do
let!(:trigger_schedule) { create(:ci_trigger_schedule, :cron_nightly_build) }