From 9dbc768db8304004c08957710d423c0b2b54510a Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 8 Dec 2015 21:00:01 -0800 Subject: Update annotations --- spec/models/note_spec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/models/note_spec.rb') diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index f347f537550..e7e8887baf2 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -16,6 +16,7 @@ # system :boolean default(FALSE), not null # st_diff :text # updated_by_id :integer +# is_award :boolean default(FALSE), not null # require 'spec_helper' -- cgit v1.2.1 From 1e8d703a854b372b12a2ad41b5e54d2abc028f74 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 9 Dec 2015 10:50:51 +0100 Subject: Tag model specs --- spec/models/note_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/models/note_spec.rb') diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index e7e8887baf2..cd3c868ecc5 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -21,7 +21,7 @@ require 'spec_helper' -describe Note do +describe Note, models: true do describe 'associations' do it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:noteable) } -- cgit v1.2.1 From e3ee46a13b91a6cefb0efb1841fb24afed37b674 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Thu, 10 Dec 2015 14:36:31 +0200 Subject: Don't allow to edit award emoji comments --- spec/models/note_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'spec/models/note_spec.rb') diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index cd3c868ecc5..5b6f177ebb2 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -142,4 +142,21 @@ describe Note, models: true do expect(Note.grouped_awards.first.last).to match_array(Note.all) end end + + describe "editable?" do + it "returns true" do + note = build(:note) + expect(note.editable?).to be_truthy + end + + it "returns false" do + note = build(:note, system: true) + expect(note.editable?).to be_falsy + end + + it "returns false" do + note = build(:note, is_award: true, note: "smiley") + expect(note.editable?).to be_falsy + end + end end -- cgit v1.2.1 From 72b7d1f59d4fb26fb9119c5a059528f0fc951904 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Fri, 11 Dec 2015 13:10:00 +0200 Subject: emoji aliases problem --- spec/models/note_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/models/note_spec.rb') diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 5b6f177ebb2..216c7dabae0 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -159,4 +159,13 @@ describe Note, models: true do expect(note.editable?).to be_falsy end end + + describe "set_award!" do + let(:issue) { create :issue } + + it "converts aliases to actual name" do + note = create :note, note: ":thumbsup:", noteable: issue + expect(note.reload.note).to eq("+1") + end + end end -- cgit v1.2.1