Commit 2dd60b9b authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use rspec's matchers and update style:

Feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4404#note_12194552
parent 0c2962eb
......@@ -856,7 +856,7 @@ describe User, models: true do
let(:project) { create(:project) }
it 'does not load' do
is_expected.to eq([])
is_expected.to be_empty
end
end
......@@ -865,19 +865,21 @@ describe User, models: true do
let(:project) { create(:project, namespace: namespace) }
it 'loads' do
is_expected.to eq([runner])
is_expected.to contain_exactly(runner)
end
end
shared_examples :member do
it 'loads when the user is a master' do
add_user(Gitlab::Access::MASTER)
is_expected.to eq([runner])
context 'when the user is a master' do
before { add_user(Gitlab::Access::MASTER) }
it { is_expected.to contain_exactly(runner) }
end
it 'does not load when the user is a developer' do
add_user(Gitlab::Access::DEVELOPER)
is_expected.to eq([])
context 'when the user is a developer' do
before { add_user(Gitlab::Access::DEVELOPER) }
it { is_expected.to be_empty }
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