diff options
Diffstat (limited to 'spec/graphql/resolvers/blobs_resolver_spec.rb')
-rw-r--r-- | spec/graphql/resolvers/blobs_resolver_spec.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/graphql/resolvers/blobs_resolver_spec.rb b/spec/graphql/resolvers/blobs_resolver_spec.rb index bc0344796ee..4b75351147c 100644 --- a/spec/graphql/resolvers/blobs_resolver_spec.rb +++ b/spec/graphql/resolvers/blobs_resolver_spec.rb @@ -26,8 +26,10 @@ RSpec.describe Resolvers::BlobsResolver do subject(:resolve_blobs) { resolve(described_class, obj: repository, args: args, ctx: { current_user: user }) } context 'when unauthorized' do - it 'raises an exception' do - expect { resolve_blobs }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) + it 'generates an error' do + expect_graphql_error_to_be_created(Gitlab::Graphql::Errors::ResourceNotAvailable) do + resolve_blobs + end end end @@ -68,6 +70,28 @@ RSpec.describe Resolvers::BlobsResolver do ) end end + + context 'when specifying an invalid ref' do + let(:ref) { 'ma:in' } + + it 'raises an ArgumentError' do + expect { resolve_blobs }.to raise_error( + Gitlab::Graphql::Errors::ArgumentError, + 'Ref is not valid' + ) + end + end + + context 'when passing an empty ref' do + let(:ref) { '' } + + it 'raises an ArgumentError' do + expect { resolve_blobs }.to raise_error( + Gitlab::Graphql::Errors::ArgumentError, + 'Ref is not valid' + ) + end + end end end end |