Commit 7bee1315 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-trailingwhitespace-cop-ee' into 'master'

[EE] Enable Layout/TrailingWhitespace cop and auto-correct offenses

See merge request !2686
parents d07368dc 902970e4
......@@ -252,6 +252,10 @@ Layout/Tab:
Layout/TrailingBlankLines:
Enabled: true
# Avoid trailing whitespace.
Layout/TrailingWhitespace:
Enabled: true
# Style #######################################################################
# Check the naming of accessor methods for get_/set_.
......
......@@ -57,11 +57,6 @@ Layout/SpaceInsideParens:
Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: false
# Offense count: 89
# Cop supports --auto-correct.
Layout/TrailingWhitespace:
Enabled: false
# Offense count: 272
RSpec/EmptyLineAfterFinalLet:
Enabled: false
......
......@@ -2,7 +2,7 @@ module Projects
module CycleAnalytics
class EventsController < Projects::ApplicationController
include CycleAnalyticsParams
before_action :authorize_read_cycle_analytics!
before_action :authorize_read_build!, only: [:test, :staging]
before_action :authorize_read_issue!, only: [:issue, :production]
......@@ -11,33 +11,33 @@ module Projects
def issue
render_events(cycle_analytics[:issue].events)
end
def plan
render_events(cycle_analytics[:plan].events)
end
def code
render_events(cycle_analytics[:code].events)
end
def test
options(events_params)[:branch] = events_params[:branch_name]
render_events(cycle_analytics[:test].events)
end
def review
render_events(cycle_analytics[:review].events)
end
def staging
render_events(cycle_analytics[:staging].events)
end
def production
render_events(cycle_analytics[:production].events)
end
private
def render_events(events)
......@@ -46,14 +46,14 @@ module Projects
format.json { render json: { events: events } }
end
end
def cycle_analytics
@cycle_analytics ||= ::CycleAnalytics.new(project, options(events_params))
end
def events_params
return {} unless params[:events].present?
params[:events].permit(:start_date, :branch_name)
end
end
......
......@@ -221,8 +221,8 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
if can?(current_user, :read_environment, environment) && environment.has_metrics?
metrics_project_environment_deployment_path(environment.project, environment, deployment)
end
metrics_monitoring_url =
metrics_monitoring_url =
if can?(current_user, :read_environment, environment)
environment_metrics_path(environment)
end
......
class Projects::PushRulesController < Projects::ApplicationController
include RepositorySettingsRedirect
# Authorize
before_action :authorize_admin_project!
before_action :check_push_rules_available!
......
module PipelineSchedulesHelper
def timezone_data
ActiveSupport::TimeZone.all.map do |timezone|
{
name: timezone.name,
offset: timezone.utc_offset,
identifier: timezone.tzinfo.identifier
ActiveSupport::TimeZone.all.map do |timezone|
{
name: timezone.name,
offset: timezone.utc_offset,
identifier: timezone.tzinfo.identifier
}
end
end
......
......@@ -2,7 +2,7 @@ module BlobViewer
class Notebook < Base
include Rich
include ClientSide
self.partial_name = 'notebook'
self.extensions = %w(ipynb)
self.binary = false
......
......@@ -12,7 +12,7 @@ class DeployKeysProject < ActiveRecord::Base
def destroy_orphaned_deploy_key
return unless self.deploy_key.destroyed_when_orphaned? && self.deploy_key.orphaned?
self.deploy_key.destroy
end
end
......@@ -14,7 +14,7 @@ class RedirectRoute < ActiveRecord::Base
else
'redirect_routes.path = ? OR redirect_routes.path LIKE ?'
end
where(wheres, path, "#{sanitize_sql_like(path)}/%")
end
end
class ProjectEntity < Grape::Entity
include RequestAwareEntity
expose :id
expose :name
......
......@@ -3,7 +3,7 @@ class AdminEmailsWorker
include DedicatedSidekiqQueue
def perform(recipient_id, subject, body)
recipient_list(recipient_id).pluck(:id).uniq.each do |user_id|
recipient_list(recipient_id).pluck(:id).uniq.each do |user_id|
Notify.send_admin_notification(user_id, subject, body).deliver_later
end
end
......
......@@ -5,5 +5,5 @@ ActsAsTaggableOn.strict_case_match = true
ActsAsTaggableOn.tags_counter = false
# validate that counter cache is disabled
raise "Counter cache is not disabled" if
raise "Counter cache is not disabled" if
ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache]
app = Rails.application
if app.config.serve_static_files
# The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory.
# The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory.
# We're replacing it with our `Gitlab::Middleware::Static` that does the same,
# except ignoring `/uploads`, letting those go through to the GitLab Rails app.
app.config.middleware.swap(
ActionDispatch::Static,
Gitlab::Middleware::Static,
app.paths["public"].first,
ActionDispatch::Static,
Gitlab::Middleware::Static,
app.paths["public"].first,
app.config.static_cache_control
)
......
......@@ -2,7 +2,7 @@
# as the ActionDispatch::Request object. This is necessary for libraries
# like rack_attack where they don't use ActionDispatch, and we want them
# to block/throttle requests on private networks.
# Rack Attack specific issue: https://github.com/kickstarter/rack-attack/issues/145
# Rack Attack specific issue: https://github.com/kickstarter/rack-attack/issues/145
module Rack
class Request
def trusted_proxy?(ip)
......
......@@ -3,7 +3,7 @@
resource :repository, only: [:create] do
member do
get ':ref/archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex, ref: /.+/ }, action: 'archive', as: 'archive'
# deprecated since GitLab 9.5
get 'archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex }, as: 'archive_alternative'
end
......
class DefaultRequestAccessProjects < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
change_column_default :projects, :request_access_enabled, false
end
......
......@@ -21,7 +21,7 @@ class UpdateRetriedForCiBuild < ActiveRecord::Migration
private
def up_mysql
# This is a trick to overcome MySQL limitation:
# This is a trick to overcome MySQL limitation:
# Mysql2::Error: Table 'ci_builds' is specified twice, both as a target for 'UPDATE' and as a separate source for data
# However, this leads to create a temporary table from `max(ci_builds.id)` which is slow and do full database update
execute <<-SQL.strip_heredoc
......
......@@ -7,7 +7,7 @@ class MigrateOldArtifacts < ActiveRecord::Migration
# This uses special heuristic to find potential candidates for data migration
# Read more about this here: https://gitlab.com/gitlab-org/gitlab-ce/issues/32036#note_30422345
def up
builds_with_artifacts.find_each do |build|
build.migrate_artifacts!
......@@ -51,14 +51,14 @@ class MigrateOldArtifacts < ActiveRecord::Migration
private
def source_artifacts_path
@source_artifacts_path ||=
@source_artifacts_path ||=
File.join(Gitlab.config.artifacts.path,
created_at.utc.strftime('%Y_%m'),
ci_id.to_s, id.to_s)
end
def target_artifacts_path
@target_artifacts_path ||=
@target_artifacts_path ||=
File.join(Gitlab.config.artifacts.path,
created_at.utc.strftime('%Y_%m'),
project_id.to_s, id.to_s)
......
......@@ -56,7 +56,7 @@ class Spinach::Features::AdminLicense < Spinach::FeatureSteps
license = build(:gitlab_license)
File.write(path, license.export)
attach_file 'license_data_file', path
click_button "Upload license"
end
......
......@@ -28,7 +28,7 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps
expect(email).to be_nil
expect(page).not_to have_content("my@email.com")
end
step 'I click link "Remove" for "my@email.com"' do
# there should only be one remove button at this time
click_link "Remove"
......
......@@ -61,7 +61,7 @@ module API
service_args = [user_project, current_user, protected_branch_params]
protected_branch = ::ProtectedBranches::CreateService.new(*service_args).execute
if protected_branch.persisted?
present protected_branch, with: Entities::ProtectedBranch, project: user_project
else
......
module Audit
class Details
ACTIONS = %i[add remove failed_login change].freeze
def self.humanize(*args)
new(*args).humanize
end
def initialize(details)
@details = details
end
def humanize
if @details[:with]
"Signed in with #{@details[:with].upcase} authentication"
......@@ -17,9 +17,9 @@ module Audit
action_text
end
end
private
def action_text
action = @details.slice(*ACTIONS)
value = @details.values.first.tr('_', ' ')
......
......@@ -6,9 +6,9 @@ module Banzai
doc.xpath('descendant-or-self::img').each do |img|
img['class'] ||= '' << 'lazy'
img['data-src'] = img['src']
img['src'] = LazyImageTagHelper.placeholder_image
img['src'] = LazyImageTagHelper.placeholder_image
end
doc
end
end
......
......@@ -7,7 +7,7 @@ class ProjectUrlConstrainer
return false unless DynamicPathValidator.valid_project_path?(full_path)
# We intentionally allow SELECT(*) here so result of this query can be used
# as cache for further Project.find_by_full_path calls within request
# as cache for further Project.find_by_full_path calls within request
Project.find_by_full_path(full_path, follow_redirects: request.get?).present?
end
end
......@@ -221,7 +221,7 @@ module DeclarativePolicy
end
# computes the given ability and prints a helpful debugging output
# showing which
# showing which
def debug(ability, *a)
runner(ability).debug(*a)
end
......
......@@ -11,11 +11,11 @@ module Gitlab
def enabled?
config.enabled
end
def reset!
Rack::Attack::Allow2Ban.reset(ip, config)
end
def register_fail!
# Allow2Ban.filter will return false if this IP has not failed too often yet
@banned = Rack::Attack::Allow2Ban.filter(ip, config) do
......@@ -23,17 +23,17 @@ module Gitlab
ip_can_be_banned?
end
end
def banned?
@banned
end
private
def config
Gitlab.config.rack_attack.git_basic_auth
end
def ip_can_be_banned?
config.ip_whitelist.exclude?(ip)
end
......
......@@ -60,7 +60,7 @@ module Gitlab
begin
path = read_string(gz).force_encoding('UTF-8')
meta = read_string(gz).force_encoding('UTF-8')
next unless path.valid_encoding? && meta.valid_encoding?
next unless path =~ match_pattern
next if path =~ INVALID_PATH_PATTERN
......
......@@ -54,7 +54,7 @@ module Gitlab
# [[commit_sha, path], [commit_sha, path], ...]. If blob_size_limit < 0 then the
# full blob contents are returned. If blob_size_limit >= 0 then each blob will
# contain no more than limit bytes in its data attribute.
#
#
# Keep in mind that this method may allocate a lot of memory. It is up
# to the caller to limit the number of blobs and blob_size_limit.
#
......
module Gitlab
module ImportExport
class AttributesFinder
def initialize(included_attributes:, excluded_attributes:, methods:)
@included_attributes = included_attributes || {}
@excluded_attributes = excluded_attributes || {}
......
......@@ -17,7 +17,7 @@ module Gitlab
value = value.first if value
break if value.present?
end
return super unless value
Gitlab::Utils.force_utf8(value)
......
......@@ -8,7 +8,7 @@ module Gitlab
def initialize(app)
@app = app
end
def call(env)
trans = Gitlab::Metrics.current_transaction
proxy_start = env['HTTP_GITLAB_WORKHORSE_PROXY_START'].presence
......
......@@ -14,7 +14,7 @@ module Gitlab
if text.start_with?('help')
header_with_list("Available commands", full_commands(trigger))
else
header_with_list("Unknown command, these commands are available", full_commands(trigger))
header_with_list("Unknown command, these commands are available", full_commands(trigger))
end
end
......
......@@ -127,7 +127,7 @@ module Gitlab
def send_artifacts_entry(build, entry)
file = build.artifacts_file
archive =
archive =
if file.file_storage?
file.path
else
......
......@@ -122,7 +122,7 @@ describe Projects::IssuesController do
_ = issue2
perform :get, :index, weight: 1
expect(response).to have_http_status(200)
expect(assigns(:issues)).to eq([issue2])
end
......
......@@ -9,7 +9,7 @@ describe Projects::PushRulesController do
sign_in(user)
end
describe '#update' do
def do_update
patch :update, namespace_id: project.namespace, project_id: project, id: 1, push_rule: { prevent_secrets: true }
......
......@@ -39,7 +39,7 @@ describe Gitlab::OAuth::User do
{ provider: 'ldapmain', extern_uid: "uid=#{uid},#{base_dn}" },
{ provider: 'kerberos', extern_uid: uid + '@' + realm }
)
expect(gl_user.email).to eq(real_email)
end
end
......
......@@ -55,7 +55,7 @@ describe SshHostKey do
expected = [key1, key2]
.map { |data| Gitlab::KeyFingerprint.new(data) }
.each_with_index
.map { |key, i| { bits: key.bits, fingerprint: key.fingerprint, type: key.type, index: i } }
.map { |key, i| { bits: key.bits, fingerprint: key.fingerprint, type: key.type, index: i } }
expect(ssh_host_key.fingerprints.as_json).to eq(expected)
end
......
......@@ -7,7 +7,7 @@ FactoryGirl.define do
end
source_job factory: :ci_build
pipeline factory: :ci_empty_pipeline
end
end
......@@ -97,7 +97,7 @@ feature 'Admin updates settings' do
context 'sign-in restrictions', :js do
it 'de-activates oauth sign-in source' do
find('.btn', text: 'GitLab.com').click
expect(find('.btn', text: 'GitLab.com')).not_to have_css('.active')
end
end
......
......@@ -744,7 +744,7 @@ describe 'Issues' do
end
describe 'confidential issue#show', js: true do
it 'shows confidential sibebar information as confidential and can be turned off' do
it 'shows confidential sibebar information as confidential and can be turned off' do
issue = create(:issue, :confidential, project: project)
visit project_issue_path(project, issue)
......
......@@ -8,7 +8,7 @@ describe 'Milestone show' do
let(:issue_params) { { project: project, assignees: [user], author: user, milestone: milestone, labels: labels } }
before do
project.add_user(user, :developer)
project.add_user(user, :developer)
sign_in(user)
end
......
......@@ -20,7 +20,7 @@ feature 'Template Undo Button', js: true do
end
end
context 'creating a non-matching file' do
context 'creating a non-matching file' do
before do
visit project_new_blob_path(project, 'master')
select_file_template_type('LICENSE')
......
......@@ -171,7 +171,7 @@ feature 'Project mirror', js: true do
click_without_sidekiq 'Save changes'
expect(page).to have_content(key.fingerprint)
expect(page).to have_content("Verified by #{h(user.name)} less than a minute ago")
expect(page).to have_content("Verified by #{h(user.name)} less than a minute ago")
end
end
end
......
......@@ -7,7 +7,7 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') }
let!(:service) { create(:prometheus_service, project: project) }
render_views
before(:all) do
......
......@@ -7,7 +7,6 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') }
let!(:service) { create(:custom_issue_tracker_service, project: project, title: 'Custom Issue Tracker') }
render_views
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Audit::Details do
let(:user) { create(:user) }
describe '.humanize' do
context 'user' do
let(:login_action) do
......@@ -13,12 +13,12 @@ describe Audit::Details do
target_details: user.name
}
end
it 'humanizes user login action' do
expect(described_class.humanize(login_action)).to eq('Signed in with LDAP authentication')
end
end
context 'project' do
let(:user_member) { create(:user) }
let(:project) { create(:project) }
......@@ -33,12 +33,12 @@ describe Audit::Details do
target_details: member.user.name
}
end
it 'humanizes add project member access action' do
expect(described_class.humanize(member_access_action)).to eq('Added user access as Developer')
end
end
context 'group' do
let(:user_member) { create(:user) }
let(:group) { create(:group) }
......@@ -54,12 +54,12 @@ describe Audit::Details do
target_details: member.user.name
}
end
it 'humanizes add group member access action' do
expect(described_class.humanize(member_access_action)).to eq('Changed access level from Guest to Owner')
end
end
context 'deploy key' do
let(:removal_action) do
{
......
......@@ -295,7 +295,7 @@ describe Gitlab::Ci::Trace::Stream do
end
context 'malicious regexp' do
let(:data) { malicious_text }
let(:data) { malicious_text }
let(:regex) { malicious_regexp }
include_examples 'malicious regexp'
......
......@@ -6,10 +6,10 @@ describe Gitlab::CycleAnalytics::BaseEventFetcher do
let(:user) { create(:user, :admin) }
let(:start_time_attrs) { Issue.arel_table[:created_at] }
let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] }
let(:options) do
let(:options) do
{ start_time_attrs: start_time_attrs,
end_time_attrs: end_time_attrs,
from: 30.days.ago }
from: 30.days.ago }
end
subject do
......
......@@ -30,8 +30,8 @@ describe Gitlab::KeyFingerprint, lib: true do
MD5_FINGERPRINTS = {
rsa: '06:b2:8a:92:df:0e:11:2c:ca:7b:8f:a4:ba:6e:4b:fd',
ecdsa: '45:ff:5b:98:9a:b6:8a:41:13:c1:30:8b:09:5e:7b:4e',
ed25519: '2e:65:6a:c8:cf:bf:b2:8b:9a:bd:6d:9f:11:5c:12:16',
ecdsa: '45:ff:5b:98:9a:b6:8a:41:13:c1:30:8b:09:5e:7b:4e',
ed25519: '2e:65:6a:c8:cf:bf:b2:8b:9a:bd:6d:9f:11:5c:12:16',
dss: '57:98:86:02:5f:9c:f4:9b:ad:5a:1e:51:92:0e:fd:2b'
}.freeze
......
......@@ -4,8 +4,8 @@ describe Gitlab::LDAP::AuthHash do
let(:auth_hash) do
described_class.new(
OmniAuth::AuthHash.new(
uid: '123456',
provider: 'ldapmain',
uid: '123456',
provider: 'ldapmain',
info: info,
extra: {
raw_info: raw_info
......@@ -33,11 +33,11 @@ describe Gitlab::LDAP::AuthHash do
context "without overridden attributes" do
it "has the correct username" do
expect(auth_hash.username).to eq("123456")
expect(auth_hash.username).to eq("123456")
end
it "has the correct name" do
expect(auth_hash.name).to eq("Smith, J.")
expect(auth_hash.name).to eq("Smith, J.")
end
end
......@@ -54,11 +54,11 @@ describe Gitlab::LDAP::AuthHash do
end
it "has the correct username" do
expect(auth_hash.username).to eq("johnsmith@example.com")
expect(auth_hash.username).to eq("johnsmith@example.com")
end
it "has the correct name" do
expect(auth_hash.name).to eq("John Smith")
expect(auth_hash.name).to eq("John Smith")
end
end
end
......@@ -481,7 +481,7 @@ describe Gitlab::OAuth::User do
email: 'admin@othermail.com'
}
end
it 'generates the username with a counter' do
expect(gl_user.username).to eq('admin1')
end
......
......@@ -2,10 +2,10 @@ require 'spec_helper'
describe Gitlab::PaginationDelegate do
context 'no data' do
let(:delegate) do
let(:delegate) do
described_class.new(page: 1,
per_page: 10,
count: 0)
count: 0)
end
it 'shows the correct total count' do
......@@ -46,10 +46,10 @@ describe Gitlab::PaginationDelegate do
end
context 'with data' do
let(:delegate) do
let(:delegate) do
described_class.new(page: 5,
per_page: 100,
count: 1000)
count: 1000)
end
it 'shows the correct total count' do
......@@ -90,10 +90,10 @@ describe Gitlab::PaginationDelegate do
end
context 'last page' do
let(:delegate) do
let(:delegate) do
described_class.new(page: 10,
per_page: 100,
count: 1000)
count: 1000)
end
it 'shows the correct total count' do
......
......@@ -24,7 +24,7 @@ describe Gitlab::Prometheus::AdditionalMetricsParser do
queries: [{ query_range: 'query_range_empty' }]
- group: group_b
priority: 1
metrics:
metrics:
- title: title
required_metrics: ['metric_a']
weight: 1
......@@ -148,7 +148,7 @@ describe Gitlab::Prometheus::AdditionalMetricsParser do
- group: group_a
priority: 1
metrics:
- title:
- title:
required_metrics: []
weight: 1
queries: []
......
......@@ -10,7 +10,7 @@ describe MigrateOldArtifacts do
before do
allow(Gitlab.config.artifacts).to receive(:path).and_return(directory)
end
after do
FileUtils.remove_entry_secure(directory)
end
......@@ -95,7 +95,7 @@ describe MigrateOldArtifacts do
FileUtils.copy(
Rails.root.join('spec/fixtures/ci_build_artifacts.zip'),
File.join(legacy_path(build), "ci_build_artifacts.zip"))
FileUtils.copy(
Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'),
File.join(legacy_path(build), "ci_build_artifacts_metadata.gz"))
......
......@@ -7,7 +7,7 @@ describe Ci::Sources::Pipeline do
it { is_expected.to belong_to(:source_project) }
it { is_expected.to belong_to(:source_job) }
it { is_expected.to belong_to(:source_pipeline) }
it { is_expected.to validate_presence_of(:project) }
it { is_expected.to validate_presence_of(:pipeline) }
......
......@@ -96,7 +96,7 @@ describe API::ProtectedBranches do
describe 'POST /projects/:id/protected_branches' do
let(:branch_name) { 'new_branch' }
context 'when authenticated as a master' do
context 'when authenticated as a master' do
before do
project.add_master(user)
end
......@@ -221,7 +221,7 @@ describe API::ProtectedBranches do
context 'when branch has a wildcard in its name' do
let(:protected_name) { 'feature*' }
it "unprotects a wildcard branch" do
delete api("/projects/#{project.id}/protected_branches/#{branch_name}", user)
......
......@@ -130,7 +130,7 @@ describe Ci::API::Builds do
register_builds info: { platform: :darwin }
expect(response).to have_http_status(201)
expect(json_response["options"]).to be_empty
end
end
......
......@@ -144,7 +144,7 @@ describe WebHookService do
describe '#async_execute' do
let(:system_hook) { create(:system_hook) }
it 'enqueue WebHookWorker' do
expect(Sidekiq::Client).to receive(:enqueue).with(WebHookWorker, project_hook.id, data, 'push_hooks')
......
#!/usr/bin/env ruby
#
#
# # generate-seed-repo-rb
#
#
# This script generates the seed_repo.rb file used by lib/gitlab/git
# tests. The seed_repo.rb file needs to be updated anytime there is a
# Git push to https://gitlab.com/gitlab-org/gitlab-git-test.
#
#
# Usage:
#
#
# ./spec/support/generate-seed-repo-rb > spec/support/seed_repo.rb
#
#
#
#
require 'erb'
require 'tempfile'
......
# AccessMatchersForController
#
# For testing authorize_xxx in controller.
# For testing authorize_xxx in controller.
module AccessMatchersForController
extend RSpec::Matchers::DSL
include Warden::Test::Helpers
......
......@@ -32,7 +32,7 @@ describe 'gitlab:artifacts namespace rake task' do
stub_artifacts_object_storage
job
end
it "migrates file to remote storage" do
subject
......
......@@ -18,7 +18,7 @@ describe ArtifactUploader do
describe '.artifacts_upload_path' do
subject { described_class.artifacts_upload_path }
it { is_expected.to start_with(local_path) }
it { is_expected.to end_with('tmp/uploads/') }
end
......@@ -35,7 +35,7 @@ describe ArtifactUploader do
context 'when using remote storage' do
let(:store) { described_class::REMOTE_STORE }
before do
stub_artifacts_object_storage
end
......
......@@ -133,7 +133,7 @@ describe ObjectStoreUploader do
let(:job) { create(:ci_build, :artifacts, artifacts_file_store: store) }
let(:uploader) { job.artifacts_file }
let(:store) { described_class::LOCAL_STORE }
subject { uploader.migrate!(new_store) }
context 'when using the same storage' do
......@@ -149,7 +149,7 @@ describe ObjectStoreUploader do
context 'when migrating to local storage' do
let(:store) { described_class::REMOTE_STORE }
let(:new_store) { described_class::LOCAL_STORE }
before do
stub_artifacts_object_storage
end
......@@ -173,10 +173,10 @@ describe ObjectStoreUploader do
it "file does exist" do
expect(File.exist?(current_path)).to eq(true)
end
context 'when storage is disabled' do
before do
stub_artifacts_object_storage(enabled: false)
stub_artifacts_object_storage(enabled: false)
end
it "to raise an error" do
......@@ -198,7 +198,7 @@ describe ObjectStoreUploader do
it "does delete original file" do
subject
expect(File.exist?(current_path)).to eq(false)
end
......
......@@ -74,7 +74,7 @@ describe UpdateAllMirrorsWorker do
def schedule_mirrors!(capacity:)
allow(Gitlab::Mirror).to receive_messages(available_capacity: capacity)
Sidekiq::Testing.fake! do
Sidekiq::Testing.fake! do
worker.schedule_mirrors!
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