Commit 1d78be71 authored by Peter Leitzen's avatar Peter Leitzen

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

Fix leaky constant in simple executor spec

See merge request gitlab-org/gitlab!32082
parents c5706c45 20697045
......@@ -372,7 +372,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb'
- 'spec/lib/gitlab/view/presenter/factory_spec.rb'
- 'spec/lib/marginalia_spec.rb'
- 'spec/lib/system_check/simple_executor_spec.rb'
- 'spec/mailers/notify_spec.rb'
- 'spec/migrations/20191125114345_add_admin_mode_protected_path_spec.rb'
- 'spec/models/concerns/batch_destroy_dependent_associations_spec.rb'
......
---
title: Fix leaky constant issue in simple executor spec
merge_request: 32082
author: Rajendra Kadam
type: fixed
......@@ -4,7 +4,17 @@ require 'spec_helper'
require 'rake_helper'
describe SystemCheck::SimpleExecutor do
class SimpleCheck < SystemCheck::BaseCheck
before do
stub_const('SimpleCheck', Class.new(SystemCheck::BaseCheck))
stub_const('OtherCheck', Class.new(SystemCheck::BaseCheck))
stub_const('SkipCheck', Class.new(SystemCheck::BaseCheck))
stub_const('DynamicSkipCheck', Class.new(SystemCheck::BaseCheck))
stub_const('MultiCheck', Class.new(SystemCheck::BaseCheck))
stub_const('SkipMultiCheck', Class.new(SystemCheck::BaseCheck))
stub_const('RepairCheck', Class.new(SystemCheck::BaseCheck))
stub_const('BugousCheck', Class.new(SystemCheck::BaseCheck))
SimpleCheck.class_eval do
set_name 'my simple check'
def check?
......@@ -12,7 +22,7 @@ describe SystemCheck::SimpleExecutor do
end
end
class OtherCheck < SystemCheck::BaseCheck
OtherCheck.class_eval do
set_name 'other check'
def check?
......@@ -24,7 +34,7 @@ describe SystemCheck::SimpleExecutor do
end
end
class SkipCheck < SystemCheck::BaseCheck
SkipCheck.class_eval do
set_name 'skip check'
set_skip_reason 'this is a skip reason'
......@@ -37,7 +47,7 @@ describe SystemCheck::SimpleExecutor do
end
end
class DynamicSkipCheck < SystemCheck::BaseCheck
DynamicSkipCheck.class_eval do
set_name 'dynamic skip check'
set_skip_reason 'this is a skip reason'
......@@ -51,7 +61,7 @@ describe SystemCheck::SimpleExecutor do
end
end
class MultiCheck < SystemCheck::BaseCheck
MultiCheck.class_eval do
set_name 'multi check'
def multi_check
......@@ -63,7 +73,7 @@ describe SystemCheck::SimpleExecutor do
end
end
class SkipMultiCheck < SystemCheck::BaseCheck
SkipMultiCheck.class_eval do
set_name 'skip multi check'
def skip?
......@@ -75,7 +85,7 @@ describe SystemCheck::SimpleExecutor do
end
end
class RepairCheck < SystemCheck::BaseCheck
RepairCheck.class_eval do
set_name 'repair check'
def check?
......@@ -91,12 +101,12 @@ describe SystemCheck::SimpleExecutor do
end
end
class BugousCheck < SystemCheck::BaseCheck
CustomError = Class.new(StandardError)
BugousCheck.class_eval do
set_name 'my bugous check'
def check?
raise CustomError, 'omg'
raise StandardError, 'omg'
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