summaryrefslogtreecommitdiff
path: root/spec/services/notes
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-12-13 19:17:19 +0000
committerPhil Hughes <me@iamphill.com>2018-12-13 19:17:19 +0000
commited3034bbb71d43b12944a9da29b5264cb3ff3312 (patch)
tree3110713f4455a4b3a830e177422663e082fc0eb9 /spec/services/notes
parenteb81c1239ef86561b4304339609be32318419dbb (diff)
downloadgitlab-ce-ed3034bbb71d43b12944a9da29b5264cb3ff3312.tar.gz
Allow suggesting single line changes in diffs
Diffstat (limited to 'spec/services/notes')
-rw-r--r--spec/services/notes/update_service_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/notes/update_service_spec.rb b/spec/services/notes/update_service_spec.rb
index 533dcdcd6cd..fd9bff46a06 100644
--- a/spec/services/notes/update_service_spec.rb
+++ b/spec/services/notes/update_service_spec.rb
@@ -20,6 +20,29 @@ describe Notes::UpdateService do
@note.reload
end
+ context 'suggestions' do
+ it 'refreshes note suggestions' do
+ markdown = <<-MARKDOWN.strip_heredoc
+ ```suggestion
+ foo
+ ```
+
+ ```suggestion
+ bar
+ ```
+ MARKDOWN
+
+ suggestion = create(:suggestion)
+ note = suggestion.note
+
+ expect { described_class.new(project, user, note: markdown).execute(note) }
+ .to change { note.suggestions.count }.from(1).to(2)
+
+ expect(note.suggestions.order(:relative_order).map(&:to_content))
+ .to eq([" foo\n", " bar\n"])
+ end
+ end
+
context 'todos' do
let!(:todo) { create(:todo, :assigned, user: user, project: project, target: issue, author: user2) }