diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-20 18:20:08 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-26 17:19:17 -0300 |
commit | e116fcab4151d61087afae17b6bf6cac58be29fc (patch) | |
tree | f641fd7f6fa036f93bcf171ffae370d29e57c5d7 /spec/services/suggestions/apply_service_spec.rb | |
parent | 3395eacb57285424b7b8d49bdf836f638af31e8c (diff) | |
download | gitlab-ce-e116fcab4151d61087afae17b6bf6cac58be29fc.tar.gz |
Always fetch MR latest version when creating suggestions
This is an issue that can only be seen through EE. Further
details can be seen on
https://gitlab.com/gitlab-org/gitlab-ee/issues/9876. In general
we should always use the latest diff version of a file in order
to both create and apply suggestions.
Diffstat (limited to 'spec/services/suggestions/apply_service_spec.rb')
-rw-r--r-- | spec/services/suggestions/apply_service_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/services/suggestions/apply_service_spec.rb b/spec/services/suggestions/apply_service_spec.rb index 8e77d582eb4..fe85b5c9065 100644 --- a/spec/services/suggestions/apply_service_spec.rb +++ b/spec/services/suggestions/apply_service_spec.rb @@ -362,6 +362,17 @@ describe Suggestions::ApplyService do project.add_maintainer(user) end + context 'diff file was not found' do + it 'returns error message' do + expect(suggestion.note).to receive(:latest_diff_file) { nil } + + result = subject.execute(suggestion) + + expect(result).to eq(message: 'The file was not found', + status: :error) + end + end + context 'suggestion was already applied' do it 'returns success status' do result = subject.execute(suggestion) |