diff options
Diffstat (limited to 'spec/services/packages/pypi/create_package_service_spec.rb')
-rw-r--r-- | spec/services/packages/pypi/create_package_service_spec.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/services/packages/pypi/create_package_service_spec.rb b/spec/services/packages/pypi/create_package_service_spec.rb index bfecb32f9ef..69905478879 100644 --- a/spec/services/packages/pypi/create_package_service_spec.rb +++ b/spec/services/packages/pypi/create_package_service_spec.rb @@ -6,12 +6,14 @@ RSpec.describe Packages::Pypi::CreatePackageService do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } - let_it_be(:params) do + + let(:requires_python) { '>=2.7' } + let(:params) do { name: 'foo', version: '1.0', content: temp_file('foo.tgz'), - requires_python: '>=2.7', + requires_python: requires_python, sha256_digest: '123', md5_digest: '567' } @@ -37,6 +39,14 @@ RSpec.describe Packages::Pypi::CreatePackageService do end end + context 'with an invalid metadata' do + let(:requires_python) { 'x' * 51 } + + it 'raises an error' do + expect { subject }.to raise_error(ActiveRecord::RecordInvalid) + end + end + context 'with an existing package' do before do described_class.new(project, user, params).execute |