diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-05 06:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-05 06:09:46 +0300 |
commit | f3d84c4f06cec626f03d3d1fb73051b1a962397d (patch) | |
tree | 88f7841301d4b3fe7b9e14392dc1befb3ed38261 /spec | |
parent | 2b4ad9a839c3c8a99b2a8f5cdcb1f30421f3ff3e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/graphql/mutations/issues/update_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/preferences_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/spam/spam_action_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/matchers/graphql_matchers.rb | 10 |
4 files changed, 12 insertions, 4 deletions
diff --git a/spec/graphql/mutations/issues/update_spec.rb b/spec/graphql/mutations/issues/update_spec.rb index da286bb4092..8c3d01918fd 100644 --- a/spec/graphql/mutations/issues/update_spec.rb +++ b/spec/graphql/mutations/issues/update_spec.rb @@ -16,6 +16,8 @@ describe Mutations::Issues::Update do let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) } let(:mutated_issue) { subject[:issue] } + specify { expect(described_class).to require_graphql_authorizations(:update_issue) } + describe '#resolve' do let(:mutation_params) do { diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb index c4ed99e56a0..7969cfd97b5 100644 --- a/spec/helpers/preferences_helper_spec.rb +++ b/spec/helpers/preferences_helper_spec.rb @@ -123,7 +123,7 @@ describe PreferencesHelper do describe '#language_choices' do it 'returns an array of all available languages' do expect(helper.language_choices).to be_an(Array) - expect(helper.language_choices.map(&:second)).to eq(Gitlab::I18n.available_locales) + expect(helper.language_choices.map(&:first)).to eq(Gitlab::I18n::AVAILABLE_LANGUAGES.values.sort) end end diff --git a/spec/services/spam/spam_action_service_spec.rb b/spec/services/spam/spam_action_service_spec.rb index 147b313dc1a..ff60eacc79d 100644 --- a/spec/services/spam/spam_action_service_spec.rb +++ b/spec/services/spam/spam_action_service_spec.rb @@ -78,7 +78,7 @@ describe Spam::SpamActionService do subject do described_service = described_class.new(spammable: issue, request: request) - described_service.execute(user_id: user.id, api: nil, recaptcha_verified: recaptcha_verified, spam_log_id: existing_spam_log.id) + described_service.execute(user: user, api: nil, recaptcha_verified: recaptcha_verified, spam_log_id: existing_spam_log.id) end before do diff --git a/spec/support/matchers/graphql_matchers.rb b/spec/support/matchers/graphql_matchers.rb index 6439b68764e..3e2193a9069 100644 --- a/spec/support/matchers/graphql_matchers.rb +++ b/spec/support/matchers/graphql_matchers.rb @@ -1,8 +1,14 @@ # frozen_string_literal: true RSpec::Matchers.define :require_graphql_authorizations do |*expected| - match do |field| - expect(field.to_graphql.metadata[:authorize]).to eq(*expected) + match do |klass| + permissions = if klass.respond_to?(:required_permissions) + klass.required_permissions + else + [klass.to_graphql.metadata[:authorize]] + end + + expect(permissions).to eq(expected) end end |