diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-01-29 17:37:24 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-02-01 16:02:03 -0500 |
commit | e48a1755f42eabb2f459028d10d2d6c1160af4af (patch) | |
tree | 38bced3a3d7fc55f70df01e1804260536b37f28d /spec/models/event_spec.rb | |
parent | b525aff665f139cd12ac5a6df78d722427e759cc (diff) | |
download | gitlab-ce-e48a1755f42eabb2f459028d10d2d6c1160af4af.tar.gz |
Add traits for the different Event types to the Event factoryrs-event-traits
Diffstat (limited to 'spec/models/event_spec.rb')
-rw-r--r-- | spec/models/event_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 349474bb656..8c90a538f57 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -19,7 +19,7 @@ describe Event, models: true do let(:project) { create(:empty_project) } it 'calls the reset_project_activity method' do - expect_any_instance_of(Event).to receive(:reset_project_activity) + expect_any_instance_of(described_class).to receive(:reset_project_activity) create_event(project, project.owner) end @@ -43,33 +43,33 @@ describe Event, models: true do describe '#membership_changed?' do context "created" do - subject { build(:event, action: Event::CREATED).membership_changed? } + subject { build(:event, :created).membership_changed? } it { is_expected.to be_falsey } end context "updated" do - subject { build(:event, action: Event::UPDATED).membership_changed? } + subject { build(:event, :updated).membership_changed? } it { is_expected.to be_falsey } end context "expired" do - subject { build(:event, action: Event::EXPIRED).membership_changed? } + subject { build(:event, :expired).membership_changed? } it { is_expected.to be_truthy } end context "left" do - subject { build(:event, action: Event::LEFT).membership_changed? } + subject { build(:event, :left).membership_changed? } it { is_expected.to be_truthy } end context "joined" do - subject { build(:event, action: Event::JOINED).membership_changed? } + subject { build(:event, :joined).membership_changed? } it { is_expected.to be_truthy } end end describe '#note?' do - subject { Event.new(project: target.project, target: target) } + subject { described_class.new(project: target.project, target: target) } context 'issue note event' do let(:target) { create(:note_on_issue) } @@ -97,7 +97,7 @@ describe Event, models: true do let(:note_on_commit) { create(:note_on_commit, project: project) } let(:note_on_issue) { create(:note_on_issue, noteable: issue, project: project) } let(:note_on_confidential_issue) { create(:note_on_issue, noteable: confidential_issue, project: project) } - let(:event) { Event.new(project: project, target: target, author_id: author.id) } + let(:event) { described_class.new(project: project, target: target, author_id: author.id) } before do project.team << [member, :developer] @@ -221,13 +221,13 @@ describe Event, models: true do let!(:event2) { create(:closed_issue_event) } describe 'without an explicit limit' do - subject { Event.limit_recent } + subject { described_class.limit_recent } it { is_expected.to eq([event2, event1]) } end describe 'with an explicit limit' do - subject { Event.limit_recent(1) } + subject { described_class.limit_recent(1) } it { is_expected.to eq([event2]) } end @@ -294,9 +294,9 @@ describe Event, models: true do } } - Event.create({ + described_class.create({ project: project, - action: Event::PUSHED, + action: described_class::PUSHED, data: data, author_id: user.id }.merge!(attrs)) |