diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-04-10 10:25:59 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-04-10 10:25:59 +0000 |
commit | 33a4439e8f079303fcf7c71267936e5c8f694958 (patch) | |
tree | 828c3c6dc55058e95927d36a3a03db9fd0263766 /spec/serializers/note_entity_spec.rb | |
parent | 2db218f8bf186c509c927ce3e9d0502fee4f8349 (diff) | |
parent | 174950b6562226beed7eef135a2450bfee60e21f (diff) | |
download | gitlab-ce-33a4439e8f079303fcf7c71267936e5c8f694958.tar.gz |
Merge branch 'master' into 'stuartnelson3/gitlab-ce-stn/issue-due-email'
# Conflicts:
# db/schema.rb
Diffstat (limited to 'spec/serializers/note_entity_spec.rb')
-rw-r--r-- | spec/serializers/note_entity_spec.rb | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/spec/serializers/note_entity_spec.rb b/spec/serializers/note_entity_spec.rb index 51a8587ace9..13cda781cda 100644 --- a/spec/serializers/note_entity_spec.rb +++ b/spec/serializers/note_entity_spec.rb @@ -10,53 +10,5 @@ describe NoteEntity do let(:user) { create(:user) } subject { entity.as_json } - context 'basic note' do - it 'exposes correct elements' do - expect(subject).to include(:type, :author, :human_access, :note, :note_html, :current_user, - :discussion_id, :emoji_awardable, :award_emoji, :toggle_award_path, :report_abuse_path, :path, :attachment) - end - - it 'does not expose elements for specific notes cases' do - expect(subject).not_to include(:last_edited_by, :last_edited_at, :system_note_icon_name) - end - - it 'exposes author correctly' do - expect(subject[:author]).to include(:id, :name, :username, :state, :avatar_url, :path) - end - - it 'does not expose web_url for author' do - expect(subject[:author]).not_to include(:web_url) - end - end - - context 'when note was edited' do - before do - note.update(updated_at: 1.minute.from_now, updated_by: user) - end - - it 'exposes last_edited_at and last_edited_by elements' do - expect(subject).to include(:last_edited_at, :last_edited_by) - end - end - - context 'when note is a system note' do - before do - note.update(system: true) - end - - it 'exposes system_note_icon_name element' do - expect(subject).to include(:system_note_icon_name) - end - end - - context 'when note is part of resolvable discussion' do - before do - allow(note).to receive(:part_of_discussion?).and_return(true) - allow(note).to receive(:resolvable?).and_return(true) - end - - it 'exposes paths to resolve note' do - expect(subject).to include(:resolve_path, :resolve_with_issue_path) - end - end + it_behaves_like 'note entity' end |