Commit f530f59c authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'fix-service-factory-to-support-parent-strategy' into 'master'

Refactor Services and Pipelines factories to support parent strategy

See merge request gitlab-org/gitlab!41693
parents 24062c3f 4edd7702
...@@ -33,7 +33,7 @@ RSpec.describe EE::ServicesHelper do ...@@ -33,7 +33,7 @@ RSpec.describe EE::ServicesHelper do
end end
context 'Jira service' do context 'Jira service' do
let(:integration) { build(:jira_service, issues_enabled: true, project_key: 'FE') } let(:integration) { create(:jira_service, project: project, issues_enabled: true, project_key: 'FE') }
it 'includes Jira specific fields' do it 'includes Jira specific fields' do
stub_licensed_features(jira_issues_integration: true) stub_licensed_features(jira_issues_integration: true)
......
...@@ -23,7 +23,7 @@ FactoryBot.define do ...@@ -23,7 +23,7 @@ FactoryBot.define do
factory :ci_pipeline do factory :ci_pipeline do
transient { ci_ref_presence { true } } transient { ci_ref_presence { true } }
after(:build) do |pipeline, evaluator| before(:create) do |pipeline, evaluator|
pipeline.ensure_ci_ref! if evaluator.ci_ref_presence && pipeline.ci_ref_id.nil? pipeline.ensure_ci_ref! if evaluator.ci_ref_presence && pipeline.ci_ref_id.nil?
end end
......
...@@ -81,7 +81,7 @@ FactoryBot.define do ...@@ -81,7 +81,7 @@ FactoryBot.define do
project_key { nil } project_key { nil }
end end
after(:build) do |service, evaluator| before(:create) do |service, evaluator|
if evaluator.create_data if evaluator.create_data
create(:jira_tracker_data, service: service, create(:jira_tracker_data, service: service,
url: evaluator.url, api_url: evaluator.api_url, jira_issue_transition_id: evaluator.jira_issue_transition_id, url: evaluator.url, api_url: evaluator.api_url, jira_issue_transition_id: evaluator.jira_issue_transition_id,
...@@ -130,7 +130,7 @@ FactoryBot.define do ...@@ -130,7 +130,7 @@ FactoryBot.define do
new_issue_url { 'http://new-issue.example.com' } new_issue_url { 'http://new-issue.example.com' }
end end
after(:build) do |service, evaluator| before(:create) do |service, evaluator|
if evaluator.create_data if evaluator.create_data
create(:issue_tracker_data, service: service, create(:issue_tracker_data, service: service,
project_url: evaluator.project_url, issues_url: evaluator.issues_url, new_issue_url: evaluator.new_issue_url project_url: evaluator.project_url, issues_url: evaluator.issues_url, new_issue_url: evaluator.new_issue_url
...@@ -151,7 +151,7 @@ FactoryBot.define do ...@@ -151,7 +151,7 @@ FactoryBot.define do
project_identifier_code { 'PRJ-1' } project_identifier_code { 'PRJ-1' }
end end
after(:build) do |service, evaluator| before(:create) do |service, evaluator|
create(:open_project_tracker_data, service: service, create(:open_project_tracker_data, service: service,
url: evaluator.url, api_url: evaluator.api_url, token: evaluator.token, url: evaluator.url, api_url: evaluator.api_url, token: evaluator.token,
closed_status_id: evaluator.closed_status_id, project_identifier_code: evaluator.project_identifier_code closed_status_id: evaluator.closed_status_id, project_identifier_code: evaluator.project_identifier_code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment