summaryrefslogtreecommitdiff
path: root/spec/services/suggestions/create_service_spec.rb
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2019-05-24 13:43:16 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2019-05-27 11:41:36 +0300
commit48d498a4eb03e42179f773183c99d0ee3598bc77 (patch)
tree9547a998226468e7008091b6c3ce6da1746a95b0 /spec/services/suggestions/create_service_spec.rb
parentc11aede97697cf154049e95495ea048dc3fa0592 (diff)
downloadgitlab-ce-id-bug-suggested-changes-remove-empty-line.tar.gz
Fix removing empty lines via suggestionsid-bug-suggested-changes-remove-empty-line
Before this fix, a suggestion which just removes an empty line wasn't appliable
Diffstat (limited to 'spec/services/suggestions/create_service_spec.rb')
-rw-r--r--spec/services/suggestions/create_service_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/suggestions/create_service_spec.rb b/spec/services/suggestions/create_service_spec.rb
index ce4990a34a4..ccd44e615a8 100644
--- a/spec/services/suggestions/create_service_spec.rb
+++ b/spec/services/suggestions/create_service_spec.rb
@@ -151,6 +151,26 @@ describe Suggestions::CreateService do
subject.execute
end
end
+
+ context 'when a patch removes an empty line' do
+ let(:markdown) do
+ <<-MARKDOWN.strip_heredoc
+ ```suggestion
+ ```
+ MARKDOWN
+ end
+ let(:position) { build_position(new_line: 13) }
+
+ it 'creates an appliable suggestion' do
+ subject.execute
+
+ suggestion = note.suggestions.last
+
+ expect(suggestion).to be_appliable
+ expect(suggestion.from_content).to eq("\n")
+ expect(suggestion.to_content).to eq("")
+ end
+ end
end
end
end