diff options
Diffstat (limited to 'spec/graphql/mutations/issues/create_spec.rb')
-rw-r--r-- | spec/graphql/mutations/issues/create_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/graphql/mutations/issues/create_spec.rb b/spec/graphql/mutations/issues/create_spec.rb index 0e7ef0e55b9..825d04ff827 100644 --- a/spec/graphql/mutations/issues/create_spec.rb +++ b/spec/graphql/mutations/issues/create_spec.rb @@ -53,7 +53,11 @@ RSpec.describe Mutations::Issues::Create do stub_spam_services end - subject { mutation.resolve(**mutation_params) } + def resolve + mutation.resolve(**mutation_params) + end + + subject { resolve } context 'when the user does not have permission to create an issue' do it 'raises an error' do @@ -61,6 +65,15 @@ RSpec.describe Mutations::Issues::Create do end end + context 'when the user has exceeded the rate limit' do + it 'raises an error' do + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(true) + project.add_developer(user) + + expect { resolve }.to raise_error(RateLimitedService::RateLimitedError, _('This endpoint has been requested too many times. Try again later.')) + end + end + context 'when the user can create an issue' do context 'when creating an issue a developer' do before do |