diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-03 20:09:14 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-06 12:18:26 +0300 |
commit | cdc1179facda972671cd80229a1db43b7f20bd52 (patch) | |
tree | 27b9dcb44a7c900b10d40698daefb6c5fba9c0a5 /spec/lib/gitlab/performance_bar_spec.rb | |
parent | 19b8d8af2c74e0ff241356d5ccb5890baa6fb7c8 (diff) |
Improve feature flag check for the performance bar
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 | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/lib/gitlab/performance_bar_spec.rb b/spec/lib/gitlab/performance_bar_spec.rb index 8667f458c98..cab267cde30 100644 --- a/spec/lib/gitlab/performance_bar_spec.rb +++ b/spec/lib/gitlab/performance_bar_spec.rb @@ -74,10 +74,33 @@ describe Gitlab::PerformanceBar 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 + it 'returns the group' do expect(described_class.allowed_group).to eq(my_group) end end end + + context 'when allowed group is nested', :nested_groups do + let!(:nested_my_group) { create(:group, parent: create(:group, path: 'my-org'), path: 'my-group') } + + before do + create(:group, path: 'my-group') + stub_performance_bar_setting(allowed_group: 'my-org/my-group') + end + + it 'returns the nested group' do + expect(described_class.allowed_group).to eq(nested_my_group) + end + end + + context 'when a nested group has the same path', :nested_groups do + before do + create(:group, :nested, path: 'my-group') + end + + it 'returns false' do + expect(described_class.allowed_group).to be_falsy + end + end end end |