Commit 663f3219 authored by Etienne Baqué's avatar Etienne Baqué

Merge branch '345317-add-group-policies-route-new-edit' into 'master'

Add group level security policies new/edit pages

See merge request gitlab-org/gitlab!83488
parents 315d88d9 c5b889fd
......@@ -11,6 +11,10 @@ module Groups
feature_category :security_orchestration
def edit
@policy_name = URI.decode_www_form_component(params[:id])
end
def index
render :index, locals: { group: group }
end
......
- add_to_breadcrumbs s_("SecurityOrchestration|Policies"), group_security_policies_path(@group)
- breadcrumb_title s_("SecurityOrchestration|Edit policy")
- page_title s_("SecurityOrchestration|Edit policy")
#js-group-policy-builder-app
- add_to_breadcrumbs s_("SecurityOrchestration|Policies"), group_security_policies_path(@group)
- breadcrumb_title s_("SecurityOrchestration|New policy")
- page_title s_("SecurityOrchestration|Policy editor")
#js-group-policy-builder-app
......@@ -170,7 +170,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
put :revoke
end
end
resources :policies, only: [:index]
resources :policies, only: [:index, :new, :edit], constraints: { id: %r{[^/]+} }
resources :merge_commit_reports, only: [:index], constraints: { format: :csv }
end
......
......@@ -5,12 +5,37 @@ require 'spec_helper'
RSpec.describe Groups::Security::PoliciesController, type: :request do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:edit) { edit_group_security_policy_url(group, id: 'temp') }
let_it_be(:index) { group_security_policies_url(group) }
let_it_be(:new) { new_group_security_policy_url(group) }
before do
sign_in(user)
end
describe 'GET #edit' do
using RSpec::Parameterized::TableSyntax
where(:feature_flag, :status) do
true | :ok
false | :not_found
end
subject(:request) { get edit }
with_them do
before do
stub_feature_flags(group_level_security_policies: feature_flag)
end
specify do
subject
expect(response).to have_gitlab_http_status(status)
end
end
end
describe 'GET #index' do
using RSpec::Parameterized::TableSyntax
......@@ -33,4 +58,27 @@ RSpec.describe Groups::Security::PoliciesController, type: :request do
end
end
end
describe 'GET #new' do
using RSpec::Parameterized::TableSyntax
where(:feature_flag, :status) do
true | :ok
false | :not_found
end
subject(:request) { get new }
with_them do
before do
stub_feature_flags(group_level_security_policies: feature_flag)
end
specify do
subject
expect(response).to have_gitlab_http_status(status)
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