Commit 0c2962eb authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use subject for more consistent testing style:

Feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4404#note_12194489
parent 5360ef2c
...@@ -848,6 +848,7 @@ describe User, models: true do ...@@ -848,6 +848,7 @@ describe User, models: true do
describe '#ci_authorized_runners' do describe '#ci_authorized_runners' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:runner) { create(:ci_runner) } let(:runner) { create(:ci_runner) }
subject { user.ci_authorized_runners }
before { project.runners << runner } before { project.runners << runner }
...@@ -855,7 +856,7 @@ describe User, models: true do ...@@ -855,7 +856,7 @@ describe User, models: true do
let(:project) { create(:project) } let(:project) { create(:project) }
it 'does not load' do it 'does not load' do
expect(user.ci_authorized_runners).to eq([]) is_expected.to eq([])
end end
end end
...@@ -864,19 +865,19 @@ describe User, models: true do ...@@ -864,19 +865,19 @@ describe User, models: true do
let(:project) { create(:project, namespace: namespace) } let(:project) { create(:project, namespace: namespace) }
it 'loads' do it 'loads' do
expect(user.ci_authorized_runners).to eq([runner]) is_expected.to eq([runner])
end end
end end
shared_examples :member do shared_examples :member do
it 'loads when the user is a master' do it 'loads when the user is a master' do
add_user(Gitlab::Access::MASTER) add_user(Gitlab::Access::MASTER)
expect(user.ci_authorized_runners).to eq([runner]) is_expected.to eq([runner])
end end
it 'does not load when the user is a developer' do it 'does not load when the user is a developer' do
add_user(Gitlab::Access::DEVELOPER) add_user(Gitlab::Access::DEVELOPER)
expect(user.ci_authorized_runners).to eq([]) is_expected.to eq([])
end end
end end
......
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