diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-07 16:35:37 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-07 16:35:37 +0000 |
commit | f50d8079f0080e60a2e2c66f0cc93fc9bd6b1c80 (patch) | |
tree | 6a04d23ec3e93d5a90f401d3f36f216621e57c48 /spec/support | |
parent | e1f6400f317160c5a1eb7ab792e7e25d1e1bb1e7 (diff) | |
parent | 1019dff2371b30979b33ce823abeadadad9cfab3 (diff) | |
download | gitlab-ce-f50d8079f0080e60a2e2c66f0cc93fc9bd6b1c80.tar.gz |
Merge branch 'ccr/weight_1481' into 'master'
Backport of 1481-changing-weight-values-should-trigger-system-notes
See merge request gitlab-org/gitlab-ce!18699
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/common_system_notes_examples.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/support/shared_examples/common_system_notes_examples.rb b/spec/support/shared_examples/common_system_notes_examples.rb new file mode 100644 index 00000000000..96ef30b7513 --- /dev/null +++ b/spec/support/shared_examples/common_system_notes_examples.rb @@ -0,0 +1,27 @@ +shared_examples 'system note creation' do |update_params, note_text| + subject { described_class.new(project, user).execute(issuable, [])} + + 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| + subject { described_class.new(project, user).execute(issuable, []) } + + 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 |