diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-04-03 19:03:00 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-04-03 19:03:00 +0300 |
commit | 65664c2eaeed853396c97a9b46e404c05209c42e (patch) | |
tree | e903e3afa6fe5c0f3492dc443776ebd1ce8ade57 /spec/serializers/project_note_entity_spec.rb | |
parent | 67ca10f33ec41e7cecac152e016aa2c0956a7586 (diff) |
Refactor discussions/notes code
Diffstat (limited to 'spec/serializers/project_note_entity_spec.rb')
-rw-r--r-- | spec/serializers/project_note_entity_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/serializers/project_note_entity_spec.rb b/spec/serializers/project_note_entity_spec.rb new file mode 100644 index 00000000000..dafd1cf603e --- /dev/null +++ b/spec/serializers/project_note_entity_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe ProjectNoteEntity do + include Gitlab::Routing + + let(:request) { double('request', current_user: user, noteable: note.noteable) } + + let(:entity) { described_class.new(note, request: request) } + let(:note) { create(:note) } + let(:user) { create(:user) } + subject { entity.as_json } + + it_behaves_like 'note entity' + + it 'exposes project-specific elements' do + expect(subject).to include(:human_access, :toggle_award_path, :path) + 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 +end |