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