diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 18:09:28 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-12 18:09:28 +0000 |
commit | ce8a0b90849ac5d1895e741c023432930f24d724 (patch) | |
tree | dbdc97de542cdbe18a2fc8b1a6b64ac0673ed3d3 /spec | |
parent | dc889678d1de8c09310b2f8f9742bb6c78a6f1a4 (diff) | |
download | gitlab-ce-ce8a0b90849ac5d1895e741c023432930f24d724.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
24 files changed, 308 insertions, 84 deletions
diff --git a/spec/factories/ci/test_case.rb b/spec/factories/ci/test_case.rb new file mode 100644 index 00000000000..8017111bcc7 --- /dev/null +++ b/spec/factories/ci/test_case.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :test_case, class: 'Gitlab::Ci::Reports::TestCase' do + name { "test-1" } + classname { "trace" } + file { "spec/trace_spec.rb" } + execution_time { 1.23 } + status { "success" } + system_output { nil } + attachment { nil } + + trait :with_attachment do + attachment { "some/path.png" } + end + + skip_create + + initialize_with do + new( + name: name, + classname: classname, + file: file, + execution_time: execution_time, + status: status, + system_output: system_output, + attachment: attachment + ) + end + end +end diff --git a/spec/factories/user_highest_roles.rb b/spec/factories/user_highest_roles.rb new file mode 100644 index 00000000000..2e3447348b7 --- /dev/null +++ b/spec/factories/user_highest_roles.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :user_highest_role do + user + end +end diff --git a/spec/features/merge_request/user_creates_image_diff_notes_spec.rb b/spec/features/merge_request/user_creates_image_diff_notes_spec.rb index e1b139c1b3b..cea9056cd93 100644 --- a/spec/features/merge_request/user_creates_image_diff_notes_spec.rb +++ b/spec/features/merge_request/user_creates_image_diff_notes_spec.rb @@ -230,7 +230,7 @@ describe 'Merge request > User creates image diff notes', :js do it_behaves_like 'onion skin' end - describe 'swipe view' do + describe 'swipe view', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/209999' do before do switch_to_swipe_view end diff --git a/spec/features/projects/active_tabs_spec.rb b/spec/features/projects/active_tabs_spec.rb index 69681da6b2a..815cf3b9c58 100644 --- a/spec/features/projects/active_tabs_spec.rb +++ b/spec/features/projects/active_tabs_spec.rb @@ -7,8 +7,6 @@ describe 'Project active tab' do let(:project) { create(:project, :repository) } before do - stub_feature_flags(analytics_pages_under_project_analytics_sidebar: { enabled: false, thing: project }) - project.add_maintainer(user) sign_in(user) end @@ -45,7 +43,7 @@ describe 'Project active tab' do it_behaves_like 'page has active tab', 'Repository' - %w(Files Commits Graph Compare Charts Branches Tags).each do |sub_menu| + %w(Files Commits Graph Compare Branches Tags).each do |sub_menu| context "on project Repository/#{sub_menu}" do before do click_tab(sub_menu) @@ -124,29 +122,23 @@ describe 'Project active tab' do end end - context 'when `analytics_pages_under_project_analytics_sidebar` feature flag is enabled' do + context 'on project Analytics' do before do - stub_feature_flags(analytics_pages_under_project_analytics_sidebar: { enabled: true, thing: project }) + visit charts_project_graph_path(project, 'master') end - context 'on project Analytics' do - before do - visit charts_project_graph_path(project, 'master') - end + context 'on project Analytics/Repository Analytics' do + it_behaves_like 'page has active tab', _('Analytics') + it_behaves_like 'page has active sub tab', _('Repository') + end - context 'on project Analytics/Repository Analytics' do - it_behaves_like 'page has active tab', _('Analytics') - it_behaves_like 'page has active sub tab', _('Repository') + context 'on project Analytics/Cycle Analytics' do + before do + click_tab(_('CI / CD')) end - context 'on project Analytics/Cycle Analytics' do - before do - click_tab(_('CI / CD')) - end - - it_behaves_like 'page has active tab', _('Analytics') - it_behaves_like 'page has active sub tab', _('CI / CD') - end + it_behaves_like 'page has active tab', _('Analytics') + it_behaves_like 'page has active sub tab', _('CI / CD') end end end diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb index 33c2e65633e..2d629ef538a 100644 --- a/spec/features/projects/user_uses_shortcuts_spec.rb +++ b/spec/features/projects/user_uses_shortcuts_spec.rb @@ -7,8 +7,6 @@ describe 'User uses shortcuts', :js do let(:user) { create(:user) } before do - stub_feature_flags(analytics_pages_under_project_analytics_sidebar: { enabled: false, thing: project }) - project.add_maintainer(user) sign_in(user) @@ -119,8 +117,8 @@ describe 'User uses shortcuts', :js do find('body').native.send_key('g') find('body').native.send_key('d') - expect(page).to have_active_navigation('Repository') - expect(page).to have_active_sub_navigation('Charts') + expect(page).to have_active_navigation(_('Analytics')) + expect(page).to have_active_sub_navigation(_('Repository')) end end @@ -211,18 +209,4 @@ describe 'User uses shortcuts', :js do expect(page).to have_active_navigation('Wiki') end end - - context 'when `analytics_pages_under_project_analytics_sidebar` feature flag is enabled' do - before do - stub_feature_flags(analytics_pages_under_project_analytics_sidebar: { enabled: true, thing: project }) - end - - it 'redirects to the repository charts page' do - find('body').native.send_key('g') - find('body').native.send_key('d') - - expect(page).to have_active_navigation(_('Analytics')) - expect(page).to have_active_sub_navigation(_('Repository')) - end - end end diff --git a/spec/javascripts/projects/project_import_gitlab_project_spec.js b/spec/frontend/projects/project_import_gitlab_project_spec.js index 3c94934699d..3c94934699d 100644 --- a/spec/javascripts/projects/project_import_gitlab_project_spec.js +++ b/spec/frontend/projects/project_import_gitlab_project_spec.js diff --git a/spec/javascripts/projects/project_new_spec.js b/spec/frontend/projects/project_new_spec.js index 7c6ff90aff6..7c6ff90aff6 100644 --- a/spec/javascripts/projects/project_new_spec.js +++ b/spec/frontend/projects/project_new_spec.js diff --git a/spec/lib/gitlab/ci/parsers/test/junit_spec.rb b/spec/lib/gitlab/ci/parsers/test/junit_spec.rb index b91cf1dd3ed..9a486c312d4 100644 --- a/spec/lib/gitlab/ci/parsers/test/junit_spec.rb +++ b/spec/lib/gitlab/ci/parsers/test/junit_spec.rb @@ -205,6 +205,75 @@ describe Gitlab::Ci::Parsers::Test::Junit do end end + context 'when data contains an attachment tag' do + let(:junit) do + <<~EOF + <testsuites> + <testsuite> + <testcase classname='Calculator' name='sumTest1' time='0.01'> + <failure>Some failure</failure> + <system-out>[[ATTACHMENT|some/path.png]]</system-out> + </testcase> + </testsuite> + </testsuites> + EOF + end + + it 'add attachment to a test case' do + expect { subject }.not_to raise_error + + expect(test_cases[0].has_attachment?).to be_truthy + expect(test_cases[0].attachment).to eq("some/path.png") + end + end + + context 'when data contains multiple attachments tag' do + let(:junit) do + <<~EOF + <testsuites> + <testsuite> + <testcase classname='Calculator' name='sumTest1' time='0.01'> + <failure>Some failure</failure> + <system-out> + [[ATTACHMENT|some/path.png]] + [[ATTACHMENT|some/path.html]] + </system-out> + </testcase> + </testsuite> + </testsuites> + EOF + end + + it 'adds the first match attachment to a test case' do + expect { subject }.not_to raise_error + + expect(test_cases[0].has_attachment?).to be_truthy + expect(test_cases[0].attachment).to eq("some/path.png") + end + end + + context 'when data does not match attachment tag regex' do + let(:junit) do + <<~EOF + <testsuites> + <testsuite> + <testcase classname='Calculator' name='sumTest1' time='0.01'> + <failure>Some failure</failure> + <system-out>[[attachment]some/path.png]]</system-out> + </testcase> + </testsuite> + </testsuites> + EOF + end + + it 'does not add attachment to a test case' do + expect { subject }.not_to raise_error + + expect(test_cases[0].has_attachment?).to be_falsy + expect(test_cases[0].attachment).to be_nil + end + end + private def flattened_test_cases(test_suite) diff --git a/spec/lib/gitlab/ci/reports/test_case_spec.rb b/spec/lib/gitlab/ci/reports/test_case_spec.rb index 20c489ee94c..c13161f3e7c 100644 --- a/spec/lib/gitlab/ci/reports/test_case_spec.rb +++ b/spec/lib/gitlab/ci/reports/test_case_spec.rb @@ -88,5 +88,17 @@ describe Gitlab::Ci::Reports::TestCase do expect { test_case }.to raise_error(ArgumentError) end end + + context 'when attachment is present' do + let(:attachment_test_case) { build(:test_case, :with_attachment) } + + it "initializes the attachment if present" do + expect(attachment_test_case.attachment).to eq("some/path.png") + end + + it '#has_attachment?' do + expect(attachment_test_case.has_attachment?).to be_truthy + end + end end end diff --git a/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb b/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb index 8b93ef86eba..0aaff12f278 100644 --- a/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb +++ b/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb @@ -124,7 +124,7 @@ describe Gitlab::SidekiqConfig::CliMethods do name: 'a', feature_category: :category_a, has_external_dependencies: false, - urgency: :default, + urgency: :low, resource_boundary: :cpu }, { @@ -145,7 +145,7 @@ describe Gitlab::SidekiqConfig::CliMethods do name: 'c', feature_category: :category_c, has_external_dependencies: false, - urgency: :none, + urgency: :throttled, resource_boundary: :memory } ] @@ -168,9 +168,9 @@ describe Gitlab::SidekiqConfig::CliMethods do # urgency 'urgency=high' | %w(a:2 b) - 'urgency=default' | %w(a) - 'urgency=high,default,none' | %w(a a:2 b c) - 'urgency=default|urgency=none' | %w(a c) + 'urgency=low' | %w(a) + 'urgency=high,low,throttled' | %w(a a:2 b c) + 'urgency=low|urgency=throttled' | %w(a c) 'urgency!=high' | %w(a c) # name diff --git a/spec/lib/gitlab/sidekiq_config/worker_spec.rb b/spec/lib/gitlab/sidekiq_config/worker_spec.rb index 71fafbf0656..817755e3507 100644 --- a/spec/lib/gitlab/sidekiq_config/worker_spec.rb +++ b/spec/lib/gitlab/sidekiq_config/worker_spec.rb @@ -88,7 +88,7 @@ describe Gitlab::SidekiqConfig::Worker do attributes_a = { feature_category: :source_code_management, has_external_dependencies: false, - urgency: :default, + urgency: :low, resource_boundary: :memory, weight: 2, idempotent: true diff --git a/spec/lib/gitlab/sidekiq_middleware/client_metrics_spec.rb b/spec/lib/gitlab/sidekiq_middleware/client_metrics_spec.rb index 689c7e40727..59639409183 100644 --- a/spec/lib/gitlab/sidekiq_middleware/client_metrics_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/client_metrics_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do let(:queue) { :test } let(:worker_class) { worker.class } let(:job) { {} } - let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "default" } } + let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "low" } } shared_examples "a metrics client middleware" do context "with mocked prometheus" do @@ -80,8 +80,8 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do context "no urgency" do it_behaves_like "a metrics client middleware" do - let(:urgency) { :none } - let(:labels) { default_labels.merge(urgency: "none") } + let(:urgency) { :throttled } + let(:labels) { default_labels.merge(urgency: "throttled") } end end diff --git a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb index d815534e873..23c5b59922b 100644 --- a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb @@ -11,7 +11,7 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do let(:job) { {} } let(:job_status) { :done } let(:labels_with_job_status) { labels.merge(job_status: job_status.to_s) } - let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "default" } } + let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "low" } } shared_examples "a metrics middleware" do context "with mocked prometheus" do @@ -202,11 +202,11 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do end context "combined" do - let(:urgency) { :none } + let(:urgency) { :throttled } let(:external_dependencies) { true } let(:resource_boundary) { :cpu } let(:feature_category) { :authentication } - let(:labels) { default_labels.merge(urgency: "none", external_dependencies: "yes", boundary: "cpu", feature_category: "authentication") } + let(:labels) { default_labels.merge(urgency: "throttled", external_dependencies: "yes", boundary: "cpu", feature_category: "authentication") } it_behaves_like "a metrics middleware" end diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 276fbc2cb54..78b93b303f7 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -201,6 +201,26 @@ describe Namespace do expect(described_class.find_by_pages_host(host)).to eq(namespace) end + context 'when there is non-top-level group with searched name' do + before do + create(:group, :nested, path: 'pages') + end + + it 'ignores this group' do + host = "pages.#{Settings.pages.host.upcase}" + + expect(described_class.find_by_pages_host(host)).to be_nil + end + + it 'finds right top level group' do + group = create(:group, path: 'pages') + + host = "pages.#{Settings.pages.host.upcase}" + + expect(described_class.find_by_pages_host(host)).to eq(group) + end + end + it "returns no result if the provided host is not subdomain of the Pages host" do create(:namespace, name: 'namespace.io') host = "namespace.io" diff --git a/spec/models/user_highest_role_spec.rb b/spec/models/user_highest_role_spec.rb new file mode 100644 index 00000000000..5d31dae8339 --- /dev/null +++ b/spec/models/user_highest_role_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe UserHighestRole do + describe 'associations' do + it { is_expected.to belong_to(:user).required } + end + + describe 'validations' do + it { is_expected.to validate_inclusion_of(:highest_access_level).in_array([nil, *Gitlab::Access.all_values]) } + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 39a31801720..6303fe8a5bb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -30,6 +30,7 @@ describe User, :do_not_mock_admin_mode do it { is_expected.to have_one(:status) } it { is_expected.to have_one(:max_access_level_membership) } it { is_expected.to have_one(:user_detail) } + it { is_expected.to have_one(:user_highest_role) } it { is_expected.to have_many(:snippets).dependent(:destroy) } it { is_expected.to have_many(:members) } it { is_expected.to have_many(:project_members) } diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 7dfa239cd1e..54bb2e670da 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -48,7 +48,7 @@ describe API::Groups do context 'when file format is not supported' do let(:file_path) { 'spec/fixtures/doc_sample.txt' } - let(:message) { 'file format is not supported. Please try one of the following supported formats: png, jpg, jpeg, gif, bmp, tiff, ico' } + let(:message) { 'file format is not supported. Please try one of the following supported formats: image/png, image/jpeg, image/gif, image/bmp, image/tiff, image/vnd.microsoft.icon' } it_behaves_like 'invalid file upload request' end diff --git a/spec/support/shared_contexts/upload_type_check_shared_context.rb b/spec/support/shared_contexts/upload_type_check_shared_context.rb index d29c498fd15..b0b569fe83f 100644 --- a/spec/support/shared_contexts/upload_type_check_shared_context.rb +++ b/spec/support/shared_contexts/upload_type_check_shared_context.rb @@ -20,6 +20,7 @@ RSpec.shared_context 'uploader with type check' do end end +# This works with the UploadTypeCheck::Concern RSpec.shared_context 'stubbed MimeMagic mime type detection' do let(:mime_type) { '' } let(:magic_mime) { mime_type } @@ -31,3 +32,19 @@ RSpec.shared_context 'stubbed MimeMagic mime type detection' do allow(MimeMagic).to receive(:by_path).with(anything).and_return(ext_mime_obj) end end + +# @param uploader [CarrierWave::Uploader::Base] uploader with extension_whitelist method. +RSpec.shared_context 'ignore extension whitelist check' do + before do + allow(uploader).to receive(:extension_whitelist).and_return(nil) + end +end + +# This works with a content_type_whitelist and content_type_blacklist type check. +# @param mime_type [String] mime type to forcibly detect. +RSpec.shared_context 'force content type detection to mime_type' do + before do + magic_mime_obj = MimeMagic.new(mime_type) + allow(MimeMagic).to receive(:by_magic).with(anything).and_return(magic_mime_obj) + end +end diff --git a/spec/support/shared_examples/uploaders/upload_type_shared_examples.rb b/spec/support/shared_examples/uploaders/upload_type_shared_examples.rb index 6e5075e135d..99da2a14bb6 100644 --- a/spec/support/shared_examples/uploaders/upload_type_shared_examples.rb +++ b/spec/support/shared_examples/uploaders/upload_type_shared_examples.rb @@ -1,5 +1,32 @@ # frozen_string_literal: true +# @param path [String] the path to file to upload. E.g. File.join('spec', 'fixtures', 'sanitized.svg') +# @param uploader [CarrierWave::Uploader::Base] uploader to handle the upload. +shared_examples 'denied carrierwave upload' do + it 'will deny upload' do + fixture_file = fixture_file_upload(path) + expect { uploader.cache!(fixture_file) }.to raise_exception(CarrierWave::IntegrityError) + end +end + +# @param path [String] the path to file to upload. E.g. File.join('spec', 'fixtures', 'sanitized.svg') +# @param uploader [CarrierWave::Uploader::Base] uploader to handle the upload. +shared_examples 'accepted carrierwave upload' do + let(:fixture_file) { fixture_file_upload(path) } + + before do + uploader.remove! + end + + it 'will accept upload' do + expect { uploader.cache!(fixture_file) }.not_to raise_exception + end + + it 'will cache uploaded file' do + expect { uploader.cache!(fixture_file) }.to change { uploader.file }.from(nil).to(kind_of(CarrierWave::SanitizedFile)) + end +end + def check_content_matches_extension!(file = double(read: nil, path: '')) magic_file = UploadTypeCheck::MagicFile.new(file) uploader.check_content_matches_extension!(magic_file) diff --git a/spec/uploaders/avatar_uploader_spec.rb b/spec/uploaders/avatar_uploader_spec.rb index 669f75b2ee8..142ee557afa 100644 --- a/spec/uploaders/avatar_uploader_spec.rb +++ b/spec/uploaders/avatar_uploader_spec.rb @@ -47,15 +47,29 @@ describe AvatarUploader do end end - context 'upload type check' do - AvatarUploader::SAFE_IMAGE_EXT.each do |ext| - context "#{ext} extension" do - it_behaves_like 'type checked uploads', filenames: "image.#{ext}" - end - end + context 'accept whitelist file content type' do + # We need to feed through a valid path, but we force the parsed mime type + # in a stub below so we can set any path. + let_it_be(:path) { File.join('spec', 'fixtures', 'video_sample.mp4') } + + where(:mime_type) { described_class::MIME_WHITELIST } + + with_them do + include_context 'force content type detection to mime_type' - context 'skip image/svg+xml integrity check' do - it_behaves_like 'skipped type checked uploads', filenames: 'image.svg' + it_behaves_like 'accepted carrierwave upload' end end + + context 'upload non-whitelisted file content type' do + let_it_be(:path) { File.join('spec', 'fixtures', 'sanitized.svg') } + + it_behaves_like 'denied carrierwave upload' + end + + context 'upload misnamed non-whitelisted file content type' do + let_it_be(:path) { File.join('spec', 'fixtures', 'not_a_png.png') } + + it_behaves_like 'denied carrierwave upload' + end end diff --git a/spec/uploaders/content_type_whitelist_spec.rb b/spec/uploaders/content_type_whitelist_spec.rb new file mode 100644 index 00000000000..be519ead1c8 --- /dev/null +++ b/spec/uploaders/content_type_whitelist_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ContentTypeWhitelist do + class DummyUploader < CarrierWave::Uploader::Base + include ContentTypeWhitelist::Concern + + def content_type_whitelist + %w[image/png image/jpeg] + end + end + + let_it_be(:model) { build_stubbed(:user) } + let_it_be(:uploader) { DummyUploader.new(model, :dummy) } + + context 'upload whitelisted file content type' do + let(:path) { File.join('spec', 'fixtures', 'rails_sample.jpg') } + + it_behaves_like 'accepted carrierwave upload' + end + + context 'upload non-whitelisted file content type' do + let(:path) { File.join('spec', 'fixtures', 'sanitized.svg') } + + it_behaves_like 'denied carrierwave upload' + end + + context 'upload misnamed non-whitelisted file content type' do + let(:path) { File.join('spec', 'fixtures', 'not_a_png.png') } + + it_behaves_like 'denied carrierwave upload' + end +end diff --git a/spec/uploaders/favicon_uploader_spec.rb b/spec/uploaders/favicon_uploader_spec.rb index 4d6c849883a..0f5941b3f0a 100644 --- a/spec/uploaders/favicon_uploader_spec.rb +++ b/spec/uploaders/favicon_uploader_spec.rb @@ -6,19 +6,35 @@ describe FaviconUploader do let_it_be(:model) { build_stubbed(:user) } let_it_be(:uploader) { described_class.new(model, :favicon) } - context 'upload type check' do - FaviconUploader::EXTENSION_WHITELIST.each do |ext| - context "#{ext} extension" do - it_behaves_like 'type checked uploads', filenames: "image.#{ext}" - end + context 'accept whitelist file content type' do + include_context 'ignore extension whitelist check' + + # We need to feed through a valid path, but we force the parsed mime type + # in a stub below so we can set any path. + let_it_be(:path) { File.join('spec', 'fixtures', 'video_sample.mp4') } + + where(:mime_type) { described_class::MIME_WHITELIST } + + with_them do + include_context 'force content type detection to mime_type' + + it_behaves_like 'accepted carrierwave upload' end end - context 'upload non-whitelisted file extensions' do - it 'will deny upload' do - path = File.join('spec', 'fixtures', 'banana_sample.gif') - fixture_file = fixture_file_upload(path) - expect { uploader.cache!(fixture_file) }.to raise_exception(CarrierWave::IntegrityError) - end + context 'upload non-whitelisted file content type' do + include_context 'ignore extension whitelist check' + + let_it_be(:path) { File.join('spec', 'fixtures', 'sanitized.svg') } + + it_behaves_like 'denied carrierwave upload' + end + + context 'upload misnamed non-whitelisted file content type' do + include_context 'ignore extension whitelist check' + + let_it_be(:path) { File.join('spec', 'fixtures', 'not_a_png.png') } + + it_behaves_like 'denied carrierwave upload' end end diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index 3437839765d..cd622807c09 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -166,7 +166,6 @@ describe 'layouts/nav/sidebar/_project' do before do allow(view).to receive(:can?).with(nil, :read_cycle_analytics, project).and_return(read_cycle_analytics) - stub_feature_flags(analytics_pages_under_project_analytics_sidebar: { enabled: false, thing: project }) end describe 'when value stream analytics is enabled' do diff --git a/spec/workers/update_merge_requests_worker_spec.rb b/spec/workers/update_merge_requests_worker_spec.rb index 486dade454a..14a363f9d59 100644 --- a/spec/workers/update_merge_requests_worker_spec.rb +++ b/spec/workers/update_merge_requests_worker_spec.rb @@ -26,17 +26,5 @@ describe UpdateMergeRequestsWorker do perform end - - context 'when slow' do - before do - stub_const("UpdateMergeRequestsWorker::LOG_TIME_THRESHOLD", -1) - end - - it 'logs debug info' do - expect(Rails.logger).to receive(:info).with(a_string_matching(/\AUpdateMergeRequestsWorker#perform.*project_id=#{project.id},user_id=#{user.id},oldrev=#{oldrev},newrev=#{newrev},ref=#{ref}/)) - - perform - end - end end end |