From 48d498a4eb03e42179f773183c99d0ee3598bc77 Mon Sep 17 00:00:00 2001 From: Igor Drozdov Date: Fri, 24 May 2019 13:43:16 +0300 Subject: Fix removing empty lines via suggestions Before this fix, a suggestion which just removes an empty line wasn't appliable --- spec/services/suggestions/create_service_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'spec/services/suggestions/create_service_spec.rb') 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 -- cgit v1.2.1