Commit da97732c authored by Stan Hu's avatar Stan Hu

Merge branch 'add_tests_for_configure_sast' into 'master'

Add more tests in request API spec for sast configuration

See merge request gitlab-org/gitlab!50583
parents 0749c673 37ac06f6
......@@ -63,6 +63,26 @@ RSpec.describe Mutations::Security::CiConfiguration::ConfigureSast do
end
end
context 'when the user does not have permission to create a new branch' do
before_all do
project.add_developer(user)
end
let(:error_message) { 'You are not allowed to create protected branches on this project.' }
it 'returns an array of errors' do
allow_next_instance_of(::Files::MultiService) do |multi_service|
allow(multi_service).to receive(:execute).and_raise(Gitlab::Git::PreReceiveError.new("GitLab: #{error_message}"))
end
expect(result).to match(
status: :error,
success_path: nil,
errors: match_array([error_message])
)
end
end
context 'when the user can create a merge request' do
before_all do
project.add_developer(user)
......
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