diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-03-14 07:00:12 +0300 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-03-14 07:46:23 +0300 |
commit | f5f243a0366d7069205c5a5a4ceb326bc0c7180e (patch) | |
tree | 076e494087a6be11cab1e45c6f5b472626981427 /spec/models/note_spec.rb | |
parent | a59b7cee0afc152efba6aa4c430c14c0b038107a (diff) |
Hide "Edited" when note is transformed or resolved
Makes `Note#edited?` return `false` when the note body was not edited
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 385b8a7959f..eb6f6ff5faf 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -208,6 +208,24 @@ describe Note do end end + describe "edited?" do + let(:note) { build(:note, updated_by_id: nil, created_at: Time.now, updated_at: Time.now + 5.hours) } + + context "with updated_by" do + it "returns true" do + note.updated_by = build(:user) + + expect(note.edited?).to be_truthy + end + end + + context "without updated_by" do + it "returns false" do + expect(note.edited?).to be_falsy + end + end + end + describe "confidential?" do it "delegates to noteable" do issue_note = build(:note, :on_issue) |