Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/notes')
-rw-r--r--spec/services/notes/copy_service_spec.rb28
-rw-r--r--spec/services/notes/create_service_spec.rb4
2 files changed, 27 insertions, 5 deletions
diff --git a/spec/services/notes/copy_service_spec.rb b/spec/services/notes/copy_service_spec.rb
index dd11fa15ea8..fd8802e6640 100644
--- a/spec/services/notes/copy_service_spec.rb
+++ b/spec/services/notes/copy_service_spec.rb
@@ -16,9 +16,8 @@ RSpec.describe Notes::CopyService do
let_it_be(:group) { create(:group) }
let_it_be(:from_project) { create(:project, :public, group: group) }
let_it_be(:to_project) { create(:project, :public, group: group) }
-
- let(:from_noteable) { create(:issue, project: from_project) }
- let(:to_noteable) { create(:issue, project: to_project) }
+ let_it_be(:from_noteable) { create(:issue, project: from_project) }
+ let_it_be(:to_noteable) { create(:issue, project: to_project) }
subject(:execute_service) { described_class.new(user, from_noteable, to_noteable).execute }
@@ -85,6 +84,15 @@ RSpec.describe Notes::CopyService do
expect(execute_service).to be_success
end
end
+
+ it 'copies rendered markdown from note_html' do
+ expect(Banzai::Renderer).not_to receive(:cacheless_render_field)
+
+ execute_service
+
+ new_note = to_noteable.notes.first
+ expect(new_note.note_html).to eq(notes.first.note_html)
+ end
end
context 'notes with mentions' do
@@ -119,6 +127,13 @@ RSpec.describe Notes::CopyService do
expect(new_note.author).to eq(note.author)
end
end
+
+ it 'does not copy rendered markdown from note_html' do
+ execute_service
+
+ new_note = to_noteable.notes.first
+ expect(new_note.note_html).not_to eq(note.note_html)
+ end
end
context 'notes with upload' do
@@ -137,6 +152,13 @@ RSpec.describe Notes::CopyService do
expect(note.note_html).not_to eq(new_note.note_html)
end
end
+
+ it 'does not copy rendered markdown from note_html' do
+ execute_service
+
+ new_note = to_noteable.notes.first
+ expect(new_note.note_html).not_to eq(note.note_html)
+ end
end
context 'discussion notes' do
diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb
index c72a9465f20..53b75a3c991 100644
--- a/spec/services/notes/create_service_spec.rb
+++ b/spec/services/notes/create_service_spec.rb
@@ -359,7 +359,7 @@ RSpec.describe Notes::CreateService do
issuable.reload.update!(title: "title")
},
expectation: ->(issuable, can_use_quick_action) {
- expect(issuable.work_in_progress?).to eq(can_use_quick_action)
+ expect(issuable.draft?).to eq(can_use_quick_action)
}
),
# Remove draft status
@@ -369,7 +369,7 @@ RSpec.describe Notes::CreateService do
issuable.reload.update!(title: "Draft: title")
},
expectation: ->(noteable, can_use_quick_action) {
- expect(noteable.work_in_progress?).not_to eq(can_use_quick_action)
+ expect(noteable.draft?).not_to eq(can_use_quick_action)
}
)
]