Avoid using subject and is_expected.to:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4404#note_12274602
This commit is contained in:
Lin Jen-Shin 2016-06-06 14:55:18 +08:00
parent 5f3e647330
commit 4fcdcc36f1
1 changed files with 8 additions and 5 deletions

View File

@ -856,7 +856,6 @@ describe User, models: true do
describe '#ci_authorized_runners' do
let(:user) { create(:user) }
let(:runner) { create(:ci_runner) }
subject { user.ci_authorized_runners }
before do
project.runners << runner
@ -866,7 +865,7 @@ describe User, models: true do
let(:project) { create(:project) }
it 'does not load' do
is_expected.to be_empty
expect(user.ci_authorized_runners).to be_empty
end
end
@ -875,7 +874,7 @@ describe User, models: true do
let(:project) { create(:project, namespace: namespace) }
it 'loads' do
is_expected.to contain_exactly(runner)
expect(user.ci_authorized_runners).to contain_exactly(runner)
end
end
@ -885,7 +884,9 @@ describe User, models: true do
add_user(Gitlab::Access::MASTER)
end
it { is_expected.to contain_exactly(runner) }
it 'loads' do
expect(user.ci_authorized_runners).to contain_exactly(runner)
end
end
context 'when the user is a developer' do
@ -893,7 +894,9 @@ describe User, models: true do
add_user(Gitlab::Access::DEVELOPER)
end
it { is_expected.to be_empty }
it 'does not load' do
expect(user.ci_authorized_runners).to be_empty
end
end
end