Commit 16cb3045 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'pl-fix-top-runtime-warnings' into 'master'

Fix top 3 Ruby runtime warnings

See merge request gitlab-org/gitlab!23509
parents ac2cda87 c25a10bb
......@@ -329,7 +329,7 @@ module EE
private
def validate_plan_name
if @plan_name.present? && PLANS.exclude?(@plan_name) # rubocop:disable Gitlab/ModuleWithInstanceVariables
if defined?(@plan_name) && @plan_name.present? && PLANS.exclude?(@plan_name) # rubocop:disable Gitlab/ModuleWithInstanceVariables
errors.add(:plan, 'is not included in the list')
end
end
......
......@@ -117,12 +117,18 @@ describe Namespace do
end
context 'with an invalid plan name' do
it 'is invalid' do
it 'is invalid when `unknown`' do
group.plan = 'unknown'
expect(group).not_to be_valid
expect(group.errors[:plan]).to include('is not included in the list')
end
it 'is valid for blank strings' do
group.plan = ' '
expect(group).to be_valid
end
end
end
......
......@@ -33,6 +33,7 @@ module DeclarativePolicy
attr_reader :steps
def initialize(steps)
@steps = steps
@state = nil
end
# We make sure only to run any given Runner once,
......
......@@ -2,6 +2,8 @@
module Gitlab
module Marginalia
cattr_accessor :enabled, default: false
MARGINALIA_FEATURE_FLAG = :marginalia
def self.set_application_name
......@@ -15,14 +17,14 @@ module Gitlab
end
def self.cached_feature_enabled?
!!@enabled
enabled
end
def self.set_feature_cache
# During db:create and db:bootstrap skip feature query as DB is not available yet.
return false unless ActiveRecord::Base.connected? && Gitlab::Database.cached_table_exists?('features')
@enabled = Feature.enabled?(MARGINALIA_FEATURE_FLAG)
self.enabled = Feature.enabled?(MARGINALIA_FEATURE_FLAG)
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