Skip to content
Snippets Groups Projects
Commit 616d1e10 authored by Jarka Kadlecova's avatar Jarka Kadlecova
Browse files

Fix text for the merge request lock system note

parent 100a7c6b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -593,7 +593,7 @@ module SystemNoteService
 
def discussion_lock(issuable, author)
action = issuable.discussion_locked? ? 'locked' : 'unlocked'
body = "#{action} this issue"
body = "#{action} this #{issuable.class.to_s.titleize.downcase}"
 
create_note(NoteSummary.new(issuable, issuable.project, author, body, action: action))
end
Loading
Loading
Loading
Loading
@@ -127,10 +127,10 @@ describe MergeRequests::UpdateService, :mailer do
end
 
it 'creates system note about discussion lock' do
note = find_note('locked this issue')
note = find_note('locked this merge request')
 
expect(note).not_to be_nil
expect(note.note).to eq 'locked this issue'
expect(note.note).to eq 'locked this merge request'
end
 
context 'when not including source branch removal options' do
Loading
Loading
Loading
Loading
@@ -1145,4 +1145,42 @@ describe SystemNoteService do
it { expect(subject.note).to eq "marked #{duplicate_issue.to_reference(project)} as a duplicate of this issue" }
end
end
describe '.discussion_lock' do
subject { described_class.discussion_lock(noteable, author) }
context 'discussion unlocked' do
it_behaves_like 'a system note' do
let(:action) { 'unlocked' }
end
it 'creates the note text correctly' do
[:issue, :merge_request].each do |type|
issuable = create(type)
expect(described_class.discussion_lock(issuable, author).note)
.to eq("unlocked this #{type.to_s.titleize.downcase}")
end
end
end
context 'discussion locked' do
before do
noteable.update_attribute(:discussion_locked, true)
end
it_behaves_like 'a system note' do
let(:action) { 'locked' }
end
it 'creates the note text correctly' do
[:issue, :merge_request].each do |type|
issuable = create(type, discussion_locked: true)
expect(described_class.discussion_lock(issuable, author).note)
.to eq("locked this #{type.to_s.titleize.downcase}")
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment