Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/packages/debian/generate_distribution_key_service_spec.rb')
-rw-r--r--spec/services/packages/debian/generate_distribution_key_service_spec.rb32
1 files changed, 10 insertions, 22 deletions
diff --git a/spec/services/packages/debian/generate_distribution_key_service_spec.rb b/spec/services/packages/debian/generate_distribution_key_service_spec.rb
index b31830c2d3b..f82d577f071 100644
--- a/spec/services/packages/debian/generate_distribution_key_service_spec.rb
+++ b/spec/services/packages/debian/generate_distribution_key_service_spec.rb
@@ -3,33 +3,21 @@
require 'spec_helper'
RSpec.describe Packages::Debian::GenerateDistributionKeyService do
- let_it_be(:user) { create(:user) }
-
let(:params) { {} }
- subject { described_class.new(current_user: user, params: params) }
+ subject { described_class.new(params: params) }
let(:response) { subject.execute }
- context 'with a user' do
- it 'returns an Hash', :aggregate_failures do
- expect(GPGME::Ctx).to receive(:new).with(armor: true, offline: true).and_call_original
- expect(User).to receive(:random_password).with(no_args).and_call_original
-
- expect(response).to be_a Hash
- expect(response.keys).to contain_exactly(:private_key, :public_key, :fingerprint, :passphrase)
- expect(response[:private_key]).to start_with('-----BEGIN PGP PRIVATE KEY BLOCK-----')
- expect(response[:public_key]).to start_with('-----BEGIN PGP PUBLIC KEY BLOCK-----')
- expect(response[:fingerprint].length).to eq(40)
- expect(response[:passphrase].length).to be > 10
- end
- end
-
- context 'without a user' do
- let(:user) { nil }
+ it 'returns an Hash', :aggregate_failures do
+ expect(GPGME::Ctx).to receive(:new).with(armor: true, offline: true).and_call_original
+ expect(User).to receive(:random_password).with(no_args).and_call_original
- it 'raises an ArgumentError' do
- expect { response }.to raise_error(ArgumentError, 'Please provide a user')
- end
+ expect(response).to be_a Hash
+ expect(response.keys).to contain_exactly(:private_key, :public_key, :fingerprint, :passphrase)
+ expect(response[:private_key]).to start_with('-----BEGIN PGP PRIVATE KEY BLOCK-----')
+ expect(response[:public_key]).to start_with('-----BEGIN PGP PUBLIC KEY BLOCK-----')
+ expect(response[:fingerprint].length).to eq(40)
+ expect(response[:passphrase].length).to be > 10
end
end