diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-01-23 12:42:26 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-01-25 11:30:44 -0200 |
commit | 1b93b3b640c6dd6377bdddb8beb77f7c3d0da3fc (patch) | |
tree | 48826d924b61eb2cae2e3f951ce13cac9efa36d6 /spec/services | |
parent | dc6091876d1c70e25f2153d24dbe04f8b4b875a9 (diff) | |
download | gitlab-ce-1b93b3b640c6dd6377bdddb8beb77f7c3d0da3fc.tar.gz |
Adjusts suggestions unable to be applied
1. Presents the system error message when available,
when applying suggestions
2. Adjusts target branch updates affecting MRs pointing
to it when there are previously created suggestions in
the MR. We just need to compare the HEAD shas from
position and MR source branch.
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/suggestions/apply_service_spec.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/spec/services/suggestions/apply_service_spec.rb b/spec/services/suggestions/apply_service_spec.rb index e5ca1c155ed..8e77d582eb4 100644 --- a/spec/services/suggestions/apply_service_spec.rb +++ b/spec/services/suggestions/apply_service_spec.rb @@ -134,12 +134,11 @@ describe Suggestions::ApplyService do end end - context 'when diff ref from position is different from repo diff refs' do + context 'when HEAD from position is different from source branch HEAD on repo' do it 'returns error message' do - outdated_refs = Gitlab::Diff::DiffRefs.new(base_sha: 'foo', start_sha: 'bar', head_sha: 'outdated') - allow(suggestion).to receive(:appliable?) { true } - allow(suggestion.position).to receive(:diff_refs) { outdated_refs } + allow(suggestion.position).to receive(:head_sha) { 'old-sha' } + allow(suggestion.noteable).to receive(:source_branch_sha) { 'new-sha' } result = subject.execute(suggestion) |