summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-05 01:54:45 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 23:46:59 +0900
commit4688eb47c6fe135fb9baad5a5d56b1dfa685cc7f (patch)
tree73ed8531a88ff7088ea419aa4518be02cd82f3ae /spec
parent1dbc888e3306f30ca0882aece86ccd1a817e0ab8 (diff)
downloadgitlab-ce-4688eb47c6fe135fb9baad5a5d56b1dfa685cc7f.tar.gz
Rename cron_time_zone to cron_timezone. Separate add_concurrent_foreign_key.
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/ci/trigger_schedules.rb8
-rw-r--r--spec/lib/gitlab/ci/cron_parser_spec.rb28
-rw-r--r--spec/lib/gitlab/import_export/safe_model_attributes.yml2
-rw-r--r--spec/models/ci/trigger_schedule_spec.rb2
-rw-r--r--spec/workers/trigger_schedule_worker_spec.rb2
5 files changed, 21 insertions, 21 deletions
diff --git a/spec/factories/ci/trigger_schedules.rb b/spec/factories/ci/trigger_schedules.rb
index 9c16d45b49a..49d2b29727f 100644
--- a/spec/factories/ci/trigger_schedules.rb
+++ b/spec/factories/ci/trigger_schedules.rb
@@ -2,7 +2,7 @@ FactoryGirl.define do
factory :ci_trigger_schedule, class: Ci::TriggerSchedule do
trigger factory: :ci_trigger_for_trigger_schedule
cron '0 1 * * *'
- cron_time_zone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
after(:build) do |trigger_schedule, evaluator|
trigger_schedule.update!(project: trigger_schedule.trigger.project)
@@ -16,17 +16,17 @@ FactoryGirl.define do
trait :nightly do
cron '0 1 * * *'
- cron_time_zone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
end
trait :weekly do
cron '0 1 * * 6'
- cron_time_zone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
end
trait :monthly do
cron '0 1 22 * *'
- cron_time_zone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
end
end
end
diff --git a/spec/lib/gitlab/ci/cron_parser_spec.rb b/spec/lib/gitlab/ci/cron_parser_spec.rb
index 1cdd8c1d2e7..b07b84027fc 100644
--- a/spec/lib/gitlab/ci/cron_parser_spec.rb
+++ b/spec/lib/gitlab/ci/cron_parser_spec.rb
@@ -6,12 +6,12 @@ describe Gitlab::Ci::CronParser do
end
describe '#next_time_from' do
- subject { described_class.new(cron, cron_time_zone).next_time_from(Time.now) }
+ subject { described_class.new(cron, cron_timezone).next_time_from(Time.now) }
- context 'when cron and cron_time_zone are valid' do
+ context 'when cron and cron_timezone are valid' do
context 'when specific time' do
let(:cron) { '3 4 5 6 *' }
- let(:cron_time_zone) { 'UTC' }
+ let(:cron_timezone) { 'UTC' }
it_behaves_like "returns time in the future"
@@ -25,7 +25,7 @@ describe Gitlab::Ci::CronParser do
context 'when specific day of week' do
let(:cron) { '* * * * 0' }
- let(:cron_time_zone) { 'UTC' }
+ let(:cron_timezone) { 'UTC' }
it_behaves_like "returns time in the future"
@@ -36,7 +36,7 @@ describe Gitlab::Ci::CronParser do
context 'when slash used' do
let(:cron) { '*/10 */6 */10 */10 *' }
- let(:cron_time_zone) { 'UTC' }
+ let(:cron_timezone) { 'UTC' }
it_behaves_like "returns time in the future"
@@ -50,7 +50,7 @@ describe Gitlab::Ci::CronParser do
context 'when range used' do
let(:cron) { '0,20,40 * 1-5 * *' }
- let(:cron_time_zone) { 'UTC' }
+ let(:cron_timezone) { 'UTC' }
it_behaves_like "returns time in the future"
@@ -60,9 +60,9 @@ describe Gitlab::Ci::CronParser do
end
end
- context 'when cron_time_zone is US/Pacific' do
+ context 'when cron_timezone is US/Pacific' do
let(:cron) { '0 0 * * *' }
- let(:cron_time_zone) { 'US/Pacific' }
+ let(:cron_timezone) { 'US/Pacific' }
it_behaves_like "returns time in the future"
@@ -72,9 +72,9 @@ describe Gitlab::Ci::CronParser do
end
end
- context 'when cron and cron_time_zone are invalid' do
+ context 'when cron and cron_timezone are invalid' do
let(:cron) { 'invalid_cron' }
- let(:cron_time_zone) { 'invalid_cron_time_zone' }
+ let(:cron_timezone) { 'invalid_cron_timezone' }
it 'returns nil' do
is_expected.to be_nil
@@ -98,17 +98,17 @@ describe Gitlab::Ci::CronParser do
end
end
- describe '#cron_time_zone_valid?' do
- subject { described_class.new(Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_CRON, cron_time_zone).cron_time_zone_valid? }
+ describe '#cron_timezone_valid?' do
+ subject { described_class.new(Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_CRON, cron_timezone).cron_timezone_valid? }
context 'when cron is valid' do
- let(:cron_time_zone) { 'Europe/Istanbul' }
+ let(:cron_timezone) { 'Europe/Istanbul' }
it { is_expected.to eq(true) }
end
context 'when cron is invalid' do
- let(:cron_time_zone) { 'Invalid-zone' }
+ let(:cron_timezone) { 'Invalid-zone' }
it { is_expected.to eq(false) }
end
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index 42082ff3dee..0c43c5662e8 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -249,7 +249,7 @@ Ci::TriggerSchedule:
- created_at
- updated_at
- cron
-- cron_time_zone
+- cron_timezone
- next_run_at
DeployKey:
- id
diff --git a/spec/models/ci/trigger_schedule_spec.rb b/spec/models/ci/trigger_schedule_spec.rb
index 9a4bf122bf0..fc01d702f65 100644
--- a/spec/models/ci/trigger_schedule_spec.rb
+++ b/spec/models/ci/trigger_schedule_spec.rb
@@ -13,7 +13,7 @@ describe Ci::TriggerSchedule, models: true do
end
it 'updates next_run_at' do
- next_time = Gitlab::Ci::CronParser.new(trigger_schedule.cron, trigger_schedule.cron_time_zone).next_time_from(Time.now)
+ next_time = Gitlab::Ci::CronParser.new(trigger_schedule.cron, trigger_schedule.cron_timezone).next_time_from(Time.now)
expect(Ci::TriggerSchedule.last.next_run_at).to eq(next_time)
end
end
diff --git a/spec/workers/trigger_schedule_worker_spec.rb b/spec/workers/trigger_schedule_worker_spec.rb
index 75a98e42ac5..9d8fd9305ca 100644
--- a/spec/workers/trigger_schedule_worker_spec.rb
+++ b/spec/workers/trigger_schedule_worker_spec.rb
@@ -23,7 +23,7 @@ describe TriggerScheduleWorker do
end
it 'updates next_run_at' do
- next_time = Gitlab::Ci::CronParser.new(trigger_schedule.cron, trigger_schedule.cron_time_zone).next_time_from(Time.now)
+ next_time = Gitlab::Ci::CronParser.new(trigger_schedule.cron, trigger_schedule.cron_timezone).next_time_from(Time.now)
expect(Ci::TriggerSchedule.last.next_run_at).to eq(next_time)
end
end