Commit e5c67baa authored by Heinrich Lee Yu's avatar Heinrich Lee Yu Committed by Peter Leitzen

Fix services factory

We should not create association records in an after(:build) because
the parent model isn't created anymore
parent c6478b70
......@@ -33,7 +33,7 @@ RSpec.describe EE::ServicesHelper do
end
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
stub_licensed_features(jira_issues_integration: true)
......
......@@ -81,7 +81,7 @@ FactoryBot.define do
project_key { nil }
end
after(:build) do |service, evaluator|
before(:create) do |service, evaluator|
if evaluator.create_data
create(:jira_tracker_data, service: service,
url: evaluator.url, api_url: evaluator.api_url, jira_issue_transition_id: evaluator.jira_issue_transition_id,
......@@ -130,7 +130,7 @@ FactoryBot.define do
new_issue_url { 'http://new-issue.example.com' }
end
after(:build) do |service, evaluator|
before(:create) do |service, evaluator|
if evaluator.create_data
create(:issue_tracker_data, service: service,
project_url: evaluator.project_url, issues_url: evaluator.issues_url, new_issue_url: evaluator.new_issue_url
......@@ -151,7 +151,7 @@ FactoryBot.define do
project_identifier_code { 'PRJ-1' }
end
after(:build) do |service, evaluator|
before(:create) do |service, evaluator|
create(:open_project_tracker_data, service: service,
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
......
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