diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-30 18:34:06 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-06 12:18:25 +0300 |
commit | 19b8d8af2c74e0ff241356d5ccb5890baa6fb7c8 (patch) | |
tree | da51ca7dcc7e8340627390c714aed36bfc35835c /spec/lib/gitlab/performance_bar_spec.rb | |
parent | c8ce1f0d5d5908351fd8a0e60c00e67c1be25ed9 (diff) |
Hide 'peek' by using 'performance bar' instead
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/lib/gitlab/performance_bar_spec.rb')
-rw-r--r-- | spec/lib/gitlab/performance_bar_spec.rb | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/spec/lib/gitlab/performance_bar_spec.rb b/spec/lib/gitlab/performance_bar_spec.rb index 56cd8813f0d..8667f458c98 100644 --- a/spec/lib/gitlab/performance_bar_spec.rb +++ b/spec/lib/gitlab/performance_bar_spec.rb @@ -25,43 +25,35 @@ describe Gitlab::PerformanceBar do end end - describe '.allowed_actor?' do - it 'returns false when given actor is not a User' do - actor = double('actor', thing: double) + describe '.allowed_user?' do + let(:user) { create(:user) } - expect(described_class.allowed_actor?(actor)).to be_falsy + before do + stub_performance_bar_setting(allowed_group: 'my-group') end - context 'when given actor is a User' do - let(:actor) { double('actor', thing: create(:user)) } - - before do - stub_performance_bar_setting(allowed_group: 'my-group') + context 'when allowed group does not exist' do + it 'returns false' do + expect(described_class.allowed_user?(user)).to be_falsy end + end - context 'when allowed group does not exist' do + context 'when allowed group exists' do + let!(:my_group) { create(:group, path: 'my-group') } + + context 'when user is not a member of the allowed group' do it 'returns false' do - expect(described_class.allowed_actor?(actor)).to be_falsy + expect(described_class.allowed_user?(user)).to be_falsy end end - context 'when allowed group exists' do - let!(:my_group) { create(:group, path: 'my-group') } - - context 'when user is not a member of the allowed group' do - it 'returns false' do - expect(described_class.allowed_actor?(actor)).to be_falsy - end + context 'when user is a member of the allowed group' do + before do + my_group.add_developer(user) end - context 'when user is a member of the allowed group' do - before do - my_group.add_developer(actor.thing) - end - - it 'returns true' do - expect(described_class.allowed_actor?(actor)).to be_truthy - end + it 'returns true' do + expect(described_class.allowed_user?(user)).to be_truthy end end end |