diff options
Diffstat (limited to 'spec/lib')
6 files changed, 14 insertions, 64 deletions
diff --git a/spec/lib/gitlab/github_gists_import/importer/gist_importer_spec.rb b/spec/lib/gitlab/github_gists_import/importer/gist_importer_spec.rb index b098a151660..b64348d447b 100644 --- a/spec/lib/gitlab/github_gists_import/importer/gist_importer_spec.rb +++ b/spec/lib/gitlab/github_gists_import/importer/gist_importer_spec.rb @@ -167,13 +167,16 @@ RSpec.describe Gitlab::GithubGistsImport::Importer::GistImporter, feature_catego before do allow(::Gitlab::CurrentSettings) .to receive(:allow_local_requests_from_web_hooks_and_services?).and_return(true) + allow(::Gitlab::CurrentSettings) + .to receive(:deny_all_requests_except_allowed?).and_return(true) end it 'raises error' do - expect(Gitlab::UrlBlocker) + expect(Gitlab::HTTP_V2::UrlBlocker) .to receive(:validate!) .with(url, ports: [80, 443], schemes: %w[http https git], - allow_localhost: true, allow_local_network: true) + allow_localhost: true, allow_local_network: true, + deny_all_requests_except_allowed: true) .and_raise(Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError) expect { subject.execute }.to raise_error(Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError) @@ -184,13 +187,16 @@ RSpec.describe Gitlab::GithubGistsImport::Importer::GistImporter, feature_catego before do allow(::Gitlab::CurrentSettings) .to receive(:allow_local_requests_from_web_hooks_and_services?).and_return(false) + allow(::Gitlab::CurrentSettings) + .to receive(:deny_all_requests_except_allowed?).and_return(true) end it 'raises error' do - expect(Gitlab::UrlBlocker) + expect(Gitlab::HTTP_V2::UrlBlocker) .to receive(:validate!) .with(url, ports: [80, 443], schemes: %w[http https git], - allow_localhost: false, allow_local_network: false) + allow_localhost: false, allow_local_network: false, + deny_all_requests_except_allowed: true) .and_raise(Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError) expect { subject.execute }.to raise_error(Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError) diff --git a/spec/lib/gitlab/github_import/importer/attachments/issues_importer_spec.rb b/spec/lib/gitlab/github_import/importer/attachments/issues_importer_spec.rb index 20152020897..223b7318d69 100644 --- a/spec/lib/gitlab/github_import/importer/attachments/issues_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/attachments/issues_importer_spec.rb @@ -41,20 +41,6 @@ RSpec.describe Gitlab::GithubImport::Importer::Attachments::IssuesImporter, feat importer.sequential_import end - context 'when flag is disabled' do - before do - stub_feature_flags(github_importer_attachments: false) - end - - it 'executes importer for both issues' do - expect_next_instances_of(Gitlab::GithubImport::Importer::NoteAttachmentsImporter, 2) do |importer| - expect(importer).to receive(:execute) - end - - importer.sequential_import - end - end - context 'when issue has already been processed' do before do importer.mark_as_imported(issue_with_attachment) diff --git a/spec/lib/gitlab/github_import/importer/attachments/merge_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/attachments/merge_requests_importer_spec.rb index 5ed6dce8507..5449d4def1f 100644 --- a/spec/lib/gitlab/github_import/importer/attachments/merge_requests_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/attachments/merge_requests_importer_spec.rb @@ -42,20 +42,6 @@ RSpec.describe Gitlab::GithubImport::Importer::Attachments::MergeRequestsImporte importer.sequential_import end - context 'when flag is disabled' do - before do - stub_feature_flags(github_importer_attachments: false) - end - - it 'executes importer for both merge requests' do - expect_next_instances_of(Gitlab::GithubImport::Importer::NoteAttachmentsImporter, 2) do |importer| - expect(importer).to receive(:execute) - end - - importer.sequential_import - end - end - context 'when merge request has already been processed' do before do importer.mark_as_imported(mr_with_attachment) diff --git a/spec/lib/gitlab/github_import/importer/attachments/notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/attachments/notes_importer_spec.rb index da0ee1ed0dd..1dfe69ec12d 100644 --- a/spec/lib/gitlab/github_import/importer/attachments/notes_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/attachments/notes_importer_spec.rb @@ -52,20 +52,6 @@ RSpec.describe Gitlab::GithubImport::Importer::Attachments::NotesImporter, featu importer.sequential_import end - context 'when flag is disabled' do - before do - stub_feature_flags(github_importer_attachments: false) - end - - it 'executes importer for both user notes' do - expect_next_instances_of(Gitlab::GithubImport::Importer::NoteAttachmentsImporter, 2) do |importer| - expect(importer).to receive(:execute) - end - - importer.sequential_import - end - end - context 'when note has already been processed' do before do importer.mark_as_imported(note_with_attachment) diff --git a/spec/lib/gitlab/github_import/importer/attachments/releases_importer_spec.rb b/spec/lib/gitlab/github_import/importer/attachments/releases_importer_spec.rb index cf51760d966..4886cb923dc 100644 --- a/spec/lib/gitlab/github_import/importer/attachments/releases_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/attachments/releases_importer_spec.rb @@ -41,20 +41,6 @@ RSpec.describe Gitlab::GithubImport::Importer::Attachments::ReleasesImporter, fe importer.sequential_import end - context 'when flag is disabled' do - before do - stub_feature_flags(github_importer_attachments: false) - end - - it 'executes importer for both releases' do - expect_next_instances_of(Gitlab::GithubImport::Importer::NoteAttachmentsImporter, 2) do |importer| - expect(importer).to receive(:execute) - end - - importer.sequential_import - end - end - context 'when release has already been processed' do before do importer.mark_as_imported(release_with_attachment) diff --git a/spec/lib/service_ping/service_ping_settings_spec.rb b/spec/lib/service_ping/service_ping_settings_spec.rb index 040a5027274..2e61b35a131 100644 --- a/spec/lib/service_ping/service_ping_settings_spec.rb +++ b/spec/lib/service_ping/service_ping_settings_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' RSpec.describe ServicePing::ServicePingSettings do using RSpec::Parameterized::TableSyntax - describe '#product_intelligence_enabled?' do - where(:usage_ping_enabled, :requires_usage_stats_consent, :expected_product_intelligence_enabled) do + describe '#enabled_and_consented?' do + where(:usage_ping_enabled, :requires_usage_stats_consent, :expected_enabled_and_consented) do # Usage ping enabled true | false | true true | true | false @@ -23,8 +23,8 @@ RSpec.describe ServicePing::ServicePingSettings do stub_config_setting(usage_ping_enabled: usage_ping_enabled) end - it 'has the correct product_intelligence_enabled?' do - expect(described_class.product_intelligence_enabled?).to eq(expected_product_intelligence_enabled) + it 'has the correct enabled_and_consented?' do + expect(described_class.enabled_and_consented?).to eq(expected_enabled_and_consented) end end end |