diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-23 21:53:29 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-05-23 21:53:29 +0300 |
commit | 6f4e977046974401a0d10120fd22d4f2f8814e45 (patch) | |
tree | 05eca29b759112d38465d632f97bc31b42e207b0 /spec/models | |
parent | 2d67845d11f171e2ca1ddd2bf1cde3b2f7f16bbf (diff) | |
parent | 921c2be44af6a5a2af2b6e17945f0301c8158214 (diff) |
Merge branch 'issue_32225' into 'master'
Add transient head_pipeline_of to pipeline factories
See merge request !11566
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/cycle_analytics/test_spec.rb | 3 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 8 |
2 files changed, 4 insertions, 7 deletions
diff --git a/spec/models/cycle_analytics/test_spec.rb b/spec/models/cycle_analytics/test_spec.rb index d0b919efcf9..fd58bd1d6ad 100644 --- a/spec/models/cycle_analytics/test_spec.rb +++ b/spec/models/cycle_analytics/test_spec.rb @@ -13,8 +13,7 @@ describe 'CycleAnalytics#test', feature: true do data_fn: lambda do |context| issue = context.create(:issue, project: context.project) merge_request = context.create_merge_request_closing_issue(issue) - pipeline = context.create(:ci_pipeline, ref: merge_request.source_branch, sha: merge_request.diff_head_sha, project: context.project) - merge_request.update(head_pipeline: pipeline) + pipeline = context.create(:ci_pipeline, ref: merge_request.source_branch, sha: merge_request.diff_head_sha, project: context.project, head_pipeline_of: merge_request) { pipeline: pipeline, issue: issue } end, start_time_conditions: [["pipeline is started", -> (context, data) { data[:pipeline].run! }]], diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index ce870fcc1d3..0e05f719499 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -718,8 +718,7 @@ describe MergeRequest, models: true do describe '#head_pipeline' do describe 'when the source project exists' do it 'returns the latest pipeline' do - pipeline = create(:ci_empty_pipeline, project: subject.source_project, ref: 'master', status: 'running', sha: "123abc") - subject.update(head_pipeline: pipeline) + pipeline = create(:ci_empty_pipeline, project: subject.source_project, ref: 'master', status: 'running', sha: "123abc", head_pipeline_of: subject) expect(subject.head_pipeline).to eq(pipeline) end @@ -1396,9 +1395,8 @@ describe MergeRequest, models: true do project: project, ref: merge_request.source_branch, sha: merge_request.diff_head_sha, - status: status) - - merge_request.update(head_pipeline: pipeline) + status: status, + head_pipeline_of: merge_request) pipeline end |