summaryrefslogtreecommitdiff
path: root/spec/models/note_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 9182b42661d..583937ca748 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -26,6 +26,8 @@ describe Note, models: true do
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:noteable) }
it { is_expected.to belong_to(:author).class_name('User') }
+
+ it { is_expected.to have_many(:todos).dependent(:destroy) }
end
describe 'validation' do
@@ -203,11 +205,19 @@ describe Note, models: true do
end
describe "set_award!" do
- let(:issue) { create :issue }
+ let(:merge_request) { create :merge_request }
it "converts aliases to actual name" do
- note = create :note, note: ":+1:", noteable: issue
+ note = create(:note, note: ":+1:", noteable: merge_request)
expect(note.reload.note).to eq("thumbsup")
end
+
+ it "is not an award emoji when comment is on a diff" do
+ note = create(:note, note: ":blowfish:", noteable: merge_request, line_code: "11d5d2e667e9da4f7f610f81d86c974b146b13bd_0_2")
+ note = note.reload
+
+ expect(note.note).to eq(":blowfish:")
+ expect(note.is_award?).to be_falsy
+ end
end
end