From cff104ec4b0dd2c53ed907ab7ca423b7c587dee8 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Mon, 28 Aug 2017 23:29:28 +0900 Subject: Fix spec --- spec/factories/ci/builds.rb | 2 +- spec/factories/ci/trigger_requests.rb | 9 ++++----- spec/features/projects/jobs_spec.rb | 2 +- spec/models/ci/build_spec.rb | 2 +- spec/requests/api/runner_spec.rb | 2 +- spec/views/projects/jobs/show.html.haml_spec.rb | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) (limited to 'spec') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 592df038aa3..25ec63de94a 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -107,7 +107,7 @@ FactoryGirl.define do end trait :triggered do - trigger_request factory: :ci_trigger_request_with_variables # TODO: + trigger_request factory: :ci_trigger_request_with_variables end after(:build) do |build, evaluator| diff --git a/spec/factories/ci/trigger_requests.rb b/spec/factories/ci/trigger_requests.rb index 10e0ab4fd3c..72dad8c418c 100644 --- a/spec/factories/ci/trigger_requests.rb +++ b/spec/factories/ci/trigger_requests.rb @@ -2,12 +2,11 @@ FactoryGirl.define do factory :ci_trigger_request, class: Ci::TriggerRequest do trigger factory: :ci_trigger + # We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables. + # Ci::TriggerRequest doesn't save variables anymore, whereas old trigger requests still persist variables. factory :ci_trigger_request_with_variables do - variables do - { - TRIGGER_KEY_1: 'TRIGGER_VALUE_1', - TRIGGER_KEY_2: 'TRIGGER_VALUE_2' - } + after(:create) do |trigger_request, evaluator| + trigger_request.update_attribute(:variables, { TRIGGER_KEY_1: 'TRIGGER_VALUE_1', TRIGGER_KEY_2: 'TRIGGER_VALUE_2' } ) end end end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 3f59a66403b..037ac00d39f 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -292,7 +292,7 @@ feature 'Jobs' do end feature 'Variables' do - let(:trigger_request) { create(:ci_trigger_request_with_variables) } # TODO: + let(:trigger_request) { create(:ci_trigger_request_with_variables) } let(:job) do create :ci_build, pipeline: pipeline, trigger_request: trigger_request diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index c0ac4816ae1..3fe3ec17d36 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1492,7 +1492,7 @@ describe Ci::Build do context 'when build is for triggers' do let(:trigger) { create(:ci_trigger, project: project) } - let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) } # TODO: + let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) } let(:user_trigger_variable) do { key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1', public: false } end diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index d3b29426db1..993164aa8fe 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -559,7 +559,7 @@ describe API::Runner do before do trigger = create(:ci_trigger, project: project) - create(:ci_trigger_request_with_variables, pipeline: pipeline, builds: [job], trigger: trigger) # TODO: + create(:ci_trigger_request_with_variables, pipeline: pipeline, builds: [job], trigger: trigger) project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value') end diff --git a/spec/views/projects/jobs/show.html.haml_spec.rb b/spec/views/projects/jobs/show.html.haml_spec.rb index 7405df1742e..117f48450e2 100644 --- a/spec/views/projects/jobs/show.html.haml_spec.rb +++ b/spec/views/projects/jobs/show.html.haml_spec.rb @@ -197,7 +197,7 @@ describe 'projects/jobs/show' do end describe 'shows trigger variables in sidebar' do - let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline) } # TODO: + let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline) } before do build.trigger_request = trigger_request -- cgit v1.2.1