Commit 784144e9 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'leaky-constant-fix-5' into 'master'

Fix leaky constant in spam constants

See merge request gitlab-org/gitlab!31959
parents eca9ae6c e4fe22a1
...@@ -374,7 +374,6 @@ RSpec/LeakyConstantDeclaration: ...@@ -374,7 +374,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/serializers/commit_entity_spec.rb' - 'spec/serializers/commit_entity_spec.rb'
- 'spec/services/clusters/applications/check_installation_progress_service_spec.rb' - 'spec/services/clusters/applications/check_installation_progress_service_spec.rb'
- 'spec/services/clusters/applications/check_uninstall_progress_service_spec.rb' - 'spec/services/clusters/applications/check_uninstall_progress_service_spec.rb'
- 'spec/support/shared_contexts/spam_constants.rb'
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb' - 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'
- 'spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb' - 'spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb'
......
---
title: Remove usage of spam constants in spec
merge_request: 31959
author: Rajendra Kadam
type: fixed
...@@ -164,6 +164,8 @@ describe 'New issue', :js do ...@@ -164,6 +164,8 @@ describe 'New issue', :js do
end end
context 'when the SpamVerdictService allows' do context 'when the SpamVerdictService allows' do
include_context 'includes Spam constants'
before do before do
allow_next_instance_of(Spam::SpamVerdictService) do |verdict_service| allow_next_instance_of(Spam::SpamVerdictService) do |verdict_service|
allow(verdict_service).to receive(:execute).and_return(ALLOW) allow(verdict_service).to receive(:execute).and_return(ALLOW)
......
# frozen_string_literal: true # frozen_string_literal: true
shared_context 'includes Spam constants' do shared_context 'includes Spam constants' do
REQUIRE_RECAPTCHA = Spam::SpamConstants::REQUIRE_RECAPTCHA before do
DISALLOW = Spam::SpamConstants::DISALLOW stub_const('REQUIRE_RECAPTCHA', Spam::SpamConstants::REQUIRE_RECAPTCHA)
ALLOW = Spam::SpamConstants::ALLOW stub_const('DISALLOW', Spam::SpamConstants::DISALLOW)
stub_const('ALLOW', Spam::SpamConstants::ALLOW)
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment