Commit 37ac06f6 authored by Saikat Sarkar's avatar Saikat Sarkar

Add more tests in request API spec for sast configuration

parent 28a2f781
...@@ -63,6 +63,26 @@ RSpec.describe Mutations::Security::CiConfiguration::ConfigureSast do ...@@ -63,6 +63,26 @@ RSpec.describe Mutations::Security::CiConfiguration::ConfigureSast do
end end
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 context 'when the user can create a merge request' do
before_all do before_all do
project.add_developer(user) 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