Commit a12a6c87 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch 'fix_ee_notes_finder_spec_describe' into 'master'

Fix describe for notes_finder_spec.rb in ee/

See merge request gitlab-org/gitlab!26568
parents da12adf9 c5f73f3e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe 'EE::NotesFinder' do describe NotesFinder do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:user) { create(:group_member, :owner, group: group, user: create(:user)).user } let(:user) { create(:group_member, :owner, group: group, user: create(:user)).user }
let(:epic) { create(:epic, :opened, author: user, group: group) } let(:epic) { create(:epic, :opened, author: user, group: group) }
...@@ -13,32 +13,32 @@ describe 'EE::NotesFinder' do ...@@ -13,32 +13,32 @@ describe 'EE::NotesFinder' do
end end
describe '#target' do describe '#target' do
subject { NotesFinder.new(user, { target_id: epic.id, target_type: 'epic', group_id: group.id }).target } subject { described_class.new(user, { target_id: epic.id, target_type: 'epic', group_id: group.id }).target }
it 'returns an epic' do it 'returns an epic' do
expect(subject).to eq(epic) expect(subject).to eq(epic)
end end
it 'fails if group id is missing' do it 'fails if group id is missing' do
expect { NotesFinder.new(user, { target_id: epic.id, target_type: 'epic' }).target }.to raise_error(ArgumentError) expect { described_class.new(user, { target_id: epic.id, target_type: 'epic' }).target }.to raise_error(ArgumentError)
end end
end end
describe '#execute' do describe '#execute' do
context 'when using target id and type of epics' do context 'when using target id and type of epics' do
subject { NotesFinder.new(user, { target_id: epic.id, target_type: 'epic', group_id: group.id }).execute } subject { described_class.new(user, { target_id: epic.id, target_type: 'epic', group_id: group.id }).execute }
it 'returns the expected notes' do it 'returns the expected notes' do
expect(subject).to eq([note]) expect(subject).to eq([note])
end end
it 'fails if group id is missing' do it 'fails if group id is missing' do
expect { NotesFinder.new(user, { target_id: epic.id, target_type: 'epic' }).execute }.to raise_error(ArgumentError) expect { described_class.new(user, { target_id: epic.id, target_type: 'epic' }).execute }.to raise_error(ArgumentError)
end end
end end
context 'when using an explicit epic target' do context 'when using an explicit epic target' do
subject { NotesFinder.new(user, { target: epic }).execute } subject { described_class.new(user, { target: epic }).execute }
it 'returns the expected notes' do it 'returns the expected notes' do
expect(subject).to eq([note]) expect(subject).to eq([note])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment