diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/presenters/event_presenter_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/presenters/event_presenter_spec.rb')
-rw-r--r-- | spec/presenters/event_presenter_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/presenters/event_presenter_spec.rb b/spec/presenters/event_presenter_spec.rb index 6798be21d28..5a67fd92c9d 100644 --- a/spec/presenters/event_presenter_spec.rb +++ b/spec/presenters/event_presenter_spec.rb @@ -38,4 +38,34 @@ RSpec.describe EventPresenter do it { is_expected.to eq([project, target]) } end end + + describe '#target_type_name' do + it 'returns design for a design event' do + expect(build(:design_event).present).to have_attributes(target_type_name: 'design') + end + + it 'returns project for a project event' do + expect(build(:project_created_event).present).to have_attributes(target_type_name: 'project') + end + + it 'returns milestone for a milestone event' do + expect(group_event.present).to have_attributes(target_type_name: 'milestone') + end + end + + describe '#note_target_type_name' do + it 'returns design for an event on a comment on a design' do + expect(build(:event, :commented, :for_design).present) + .to have_attributes(note_target_type_name: 'design') + end + + it 'returns nil for an event without a target' do + expect(build(:event).present).to have_attributes(note_target_type_name: be_nil) + end + + it 'returns issue for an issue comment event' do + expect(build(:event, :commented, target: build(:note_on_issue)).present) + .to have_attributes(note_target_type_name: 'issue') + end + end end |