Commit 003a645a authored by manojmj's avatar manojmj

Revert "Fix bug in group security dashboard"

This reverts commit 627dfde1272ef142474e08e1a395d968d1ad8b1e.
parent 52ea9097
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Groups::SecurityFeaturesHelper module Groups::SecurityFeaturesHelper
def group_level_security_dashboard_available?(group) def group_level_security_dashboard_available?(group)
can?(current_user, :read_group_security_dashboard, group) group.feature_available?(:security_dashboard)
end end
def group_level_compliance_dashboard_available?(group) def group_level_compliance_dashboard_available?(group)
......
...@@ -9,19 +9,18 @@ RSpec.describe Groups::SecurityFeaturesHelper do ...@@ -9,19 +9,18 @@ RSpec.describe Groups::SecurityFeaturesHelper do
let_it_be(:user, refind: true) { create(:user) } let_it_be(:user, refind: true) { create(:user) }
before do before do
allow(helper).to receive(:can?) { |*args| Ability.allowed?(*args) }
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user).and_return(user)
end end
describe '#group_level_security_dashboard_available?' do describe '#group_level_security_dashboard_available?' do
where(:read_group_security_dashboard_permission, :result) do where(:security_dashboard_feature_enabled, :result) do
false | false
true | true true | true
false | false
end end
with_them do with_them do
before do before do
allow(helper).to receive(:can?).with(user, :read_group_security_dashboard, group).and_return(read_group_security_dashboard_permission) stub_licensed_features(security_dashboard: security_dashboard_feature_enabled)
end end
it 'returns the expected result' do it 'returns the expected result' do
......
...@@ -109,18 +109,11 @@ RSpec.describe 'layouts/nav/sidebar/_group' do ...@@ -109,18 +109,11 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
stub_licensed_features(security_dashboard: true) stub_licensed_features(security_dashboard: true)
end end
context 'when the user has access to Compliance dashboard' do it 'is visible' do
before do render
group.add_developer(user)
allow(view).to receive(:current_user).and_return(user)
end
it 'is visible' do
render
expect(rendered).to have_link 'Security & Compliance' expect(rendered).to have_link 'Security & Compliance'
expect(rendered).to have_link 'Security' expect(rendered).to have_link 'Security'
end
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