blob: 5bf8be9d6e558c5128cbcb48297079ccbaacb46e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Sidebars::Groups::Menus::KubernetesMenu, :request_store do
let_it_be(:owner) { create(:user) }
let_it_be(:group) do
build(:group, :private).tap do |g|
g.add_owner(owner)
end
end
let(:user) { owner }
let(:context) { Sidebars::Groups::Context.new(current_user: user, container: group) }
let(:menu) { described_class.new(context) }
describe '#render?' do
context 'when user can read clusters' do
it 'returns true' do
expect(menu.render?).to eq true
end
end
context 'when user cannot read clusters rules' do
let(:user) { nil }
it 'returns false' do
expect(menu.render?).to eq false
end
end
context ':certificate_based_clusters feature flag is disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it 'returns false' do
expect(menu.render?).to eq false
end
end
end
end
|