diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-06-02 08:15:45 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-06-07 17:34:09 +0300 |
commit | 2dd60b9b3f400e7709000eb1b4b7b7ab21326d5f (patch) | |
tree | 2dd8d14f62a6b9a372e0ddeabe46b651c48a8fb8 /spec | |
parent | 0c2962eb86c4f6e938ad817372498e6600a19a1c (diff) |
Use rspec's matchers and update style:
Feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4404#note_12194552
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/user_spec.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d9e65586a8e..4c213f633de 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 |