diff options
Diffstat (limited to 'spec/factories/ci/builds.rb')
-rw-r--r-- | spec/factories/ci/builds.rb | 138 |
1 files changed, 70 insertions, 68 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index e3b7c64176a..6725cde08f2 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -4,13 +4,13 @@ include ActionDispatch::TestProcess FactoryBot.define do factory :ci_build, class: Ci::Build do - name 'test' - stage 'test' - stage_idx 0 - ref 'master' - tag false - protected false - created_at 'Di 29. Okt 09:50:00 CET 2013' + name { 'test' } + stage { 'test' } + stage_idx { 0 } + ref { 'master' } + tag { false } + add_attribute(:protected) { false } + created_at { 'Di 29. Okt 09:50:00 CET 2013' } pending options do @@ -30,127 +30,127 @@ FactoryBot.define do pipeline factory: :ci_pipeline trait :degenerated do - options nil - yaml_variables nil + options { nil } + yaml_variables { nil } end trait :started do - started_at 'Di 29. Okt 09:51:28 CET 2013' + started_at { 'Di 29. Okt 09:51:28 CET 2013' } end trait :finished do started - finished_at 'Di 29. Okt 09:53:28 CET 2013' + finished_at { 'Di 29. Okt 09:53:28 CET 2013' } end trait :success do finished - status 'success' + status { 'success' } end trait :failed do finished - status 'failed' + status { 'failed' } end trait :canceled do finished - status 'canceled' + status { 'canceled' } end trait :skipped do started - status 'skipped' + status { 'skipped' } end trait :running do started - status 'running' + status { 'running' } end trait :pending do - queued_at 'Di 29. Okt 09:50:59 CET 2013' - status 'pending' + queued_at { 'Di 29. Okt 09:50:59 CET 2013' } + status { 'pending' } end trait :created do - status 'created' + status { 'created' } end trait :preparing do - status 'preparing' + status { 'preparing' } end trait :scheduled do schedulable - status 'scheduled' + status { 'scheduled' } scheduled_at { 1.minute.since } end trait :expired_scheduled do schedulable - status 'scheduled' + status { 'scheduled' } scheduled_at { 1.minute.ago } end trait :manual do - status 'manual' - self.when 'manual' + status { 'manual' } + self.when { 'manual' } end trait :teardown_environment do - environment 'staging' + environment { 'staging' } options do { script: %w(ls), environment: { name: 'staging', - action: 'stop', - url: 'http://staging.example.com/$CI_JOB_NAME' } + action: 'stop', + url: 'http://staging.example.com/$CI_JOB_NAME' } } end end trait :deploy_to_production do - environment 'production' + environment { 'production' } options do { script: %w(ls), environment: { name: 'production', - url: 'http://prd.example.com/$CI_JOB_NAME' } + url: 'http://prd.example.com/$CI_JOB_NAME' } } end end trait :start_review_app do - environment 'review/$CI_COMMIT_REF_NAME' + environment { 'review/$CI_COMMIT_REF_NAME' } options do { script: %w(ls), environment: { name: 'review/$CI_COMMIT_REF_NAME', - url: 'http://staging.example.com/$CI_JOB_NAME', - on_stop: 'stop_review_app' } + url: 'http://staging.example.com/$CI_JOB_NAME', + on_stop: 'stop_review_app' } } end end trait :stop_review_app do - name 'stop_review_app' - environment 'review/$CI_COMMIT_REF_NAME' + name { 'stop_review_app' } + environment { 'review/$CI_COMMIT_REF_NAME' } options do { script: %w(ls), environment: { name: 'review/$CI_COMMIT_REF_NAME', - url: 'http://staging.example.com/$CI_JOB_NAME', - action: 'stop' } + url: 'http://staging.example.com/$CI_JOB_NAME', + action: 'stop' } } end end trait :allowed_to_fail do - allow_failure true + allow_failure { true } end trait :ignored do @@ -166,7 +166,7 @@ FactoryBot.define do end trait :schedulable do - self.when 'delayed' + self.when { 'delayed' } options do { @@ -177,11 +177,11 @@ FactoryBot.define do end trait :actionable do - self.when 'manual' + self.when { 'manual' } end trait :retried do - retried true + retried { true } end trait :cancelable do @@ -194,11 +194,13 @@ FactoryBot.define do end trait :tags do - tag_list [:docker, :ruby] + tag_list do + [:docker, :ruby] + end end trait :on_tag do - tag true + tag { true } end trait :triggered do @@ -210,12 +212,12 @@ FactoryBot.define do end trait :tag do - tag true + tag { true } end trait :coverage do - coverage 99.9 - coverage_regex '/(d+)/' + coverage { 99.9 } + coverage_regex { '/(d+)/' } end trait :trace_live do @@ -303,23 +305,23 @@ FactoryBot.define do trait :extended_options do options do { - image: { name: 'ruby:2.1', entrypoint: '/bin/sh' }, - services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }], - script: %w(echo), - after_script: %w(ls date), - artifacts: { - name: 'artifacts_file', - untracked: false, - paths: ['out/'], - when: 'always', - expire_in: '7d' - }, - cache: { - key: 'cache_key', - untracked: false, - paths: ['vendor/*'], - policy: 'pull-push' - } + image: { name: 'ruby:2.1', entrypoint: '/bin/sh' }, + services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }], + script: %w(echo), + after_script: %w(ls date), + artifacts: { + name: 'artifacts_file', + untracked: false, + paths: ['out/'], + when: 'always', + expire_in: '7d' + }, + cache: { + key: 'cache_key', + untracked: false, + paths: ['vendor/*'], + policy: 'pull-push' + } } end end @@ -329,27 +331,27 @@ FactoryBot.define do end trait :non_playable do - status 'created' - self.when 'manual' + status { 'created' } + self.when { 'manual' } end trait :protected do - protected true + add_attribute(:protected) { true } end trait :script_failure do failed - failure_reason 1 + failure_reason { 1 } end trait :api_failure do failed - failure_reason 2 + failure_reason { 2 } end trait :prerequisite_failure do failed - failure_reason 10 + failure_reason { 10 } end trait :with_runner_session do |