2018-05-02 21:34:05 +00:00
|
|
|
shared_examples 'system note creation' do |update_params, note_text|
|
2018-12-17 04:35:59 +00:00
|
|
|
subject { described_class.new(project, user).execute(issuable, old_labels: []) }
|
2018-05-02 21:34:05 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
issuable.assign_attributes(update_params)
|
|
|
|
issuable.save
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates 1 system note with the correct content' do
|
|
|
|
expect { subject }.to change { Note.count }.from(0).to(1)
|
|
|
|
|
|
|
|
note = Note.last
|
|
|
|
expect(note.note).to match(note_text)
|
|
|
|
expect(note.noteable_type).to eq(issuable.class.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'WIP notes creation' do |wip_action|
|
2018-12-17 04:35:59 +00:00
|
|
|
subject { described_class.new(project, user).execute(issuable, old_labels: []) }
|
2018-05-02 21:34:05 +00:00
|
|
|
|
|
|
|
it 'creates WIP toggle and title change notes' do
|
|
|
|
expect { subject }.to change { Note.count }.from(0).to(2)
|
|
|
|
|
|
|
|
expect(Note.first.note).to match("#{wip_action} as a **Work In Progress**")
|
|
|
|
expect(Note.second.note).to match('changed title')
|
|
|
|
end
|
|
|
|
end
|