summaryrefslogtreecommitdiff
path: root/spec/services/suggestions/apply_service_spec.rb
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2019-02-20 18:20:08 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2019-02-26 17:19:17 -0300
commite116fcab4151d61087afae17b6bf6cac58be29fc (patch)
treef641fd7f6fa036f93bcf171ffae370d29e57c5d7 /spec/services/suggestions/apply_service_spec.rb
parent3395eacb57285424b7b8d49bdf836f638af31e8c (diff)
downloadgitlab-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.rb11
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)