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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-23 12:10:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-23 12:10:03 +0300
commit65f7976d0cd11d91a4c0945b2c63a1aa2f888b07 (patch)
tree07a0e774b12b29352ca6b3bd87b108879ebb00b9 /spec/services
parent1165608bfd217a96e133487d6049a989a15789c4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/issues/update_service_spec.rb4
-rw-r--r--spec/services/notes/build_service_spec.rb2
-rw-r--r--spec/services/packages/debian/generate_distribution_key_service_spec.rb35
3 files changed, 39 insertions, 2 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index fd42a84e405..88deeea49e5 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -1014,13 +1014,15 @@ RSpec.describe Issues::UpdateService, :mailer do
with_them do
it 'broadcasts to the issues channel based on ActionCable and feature flag values' do
- expect(Gitlab::ActionCable::Config).to receive(:in_app?).and_return(action_cable_in_app_enabled)
+ allow(Gitlab::ActionCable::Config).to receive(:in_app?).and_return(action_cable_in_app_enabled)
stub_feature_flags(broadcast_issue_updates: feature_flag_enabled)
if should_broadcast
expect(IssuesChannel).to receive(:broadcast_to).with(issue, event: 'updated')
+ expect(GraphqlTriggers).to receive(:issuable_assignees_updated).with(issue)
else
expect(IssuesChannel).not_to receive(:broadcast_to)
+ expect(GraphqlTriggers).not_to receive(:issuable_assignees_updated).with(issue)
end
update_issue(update_params)
diff --git a/spec/services/notes/build_service_spec.rb b/spec/services/notes/build_service_spec.rb
index deeab66c4e9..b7b08390dcd 100644
--- a/spec/services/notes/build_service_spec.rb
+++ b/spec/services/notes/build_service_spec.rb
@@ -173,7 +173,7 @@ RSpec.describe Notes::BuildService do
let(:user) { create(:user) }
it 'returns `Discussion to reply to cannot be found` error' do
- expect(new_note.errors.first).to include("Discussion to reply to cannot be found")
+ expect(new_note.errors.added?(:base, "Discussion to reply to cannot be found")).to be true
end
end
end
diff --git a/spec/services/packages/debian/generate_distribution_key_service_spec.rb b/spec/services/packages/debian/generate_distribution_key_service_spec.rb
new file mode 100644
index 00000000000..b31830c2d3b
--- /dev/null
+++ b/spec/services/packages/debian/generate_distribution_key_service_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+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) }
+
+ 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 'raises an ArgumentError' do
+ expect { response }.to raise_error(ArgumentError, 'Please provide a user')
+ end
+ end
+end