Commit dd6774f2 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Return false for test envs on Gitlab.dev_or_com? call

The behavior was moved to ApplicationSetting#should_check_namespace_plan? in order to it keep being tested on test environments without needing a explicit stub
parent bd54136e
......@@ -107,7 +107,7 @@ module EE
end
def should_check_namespace_plan?
check_namespace_plan? && ::Gitlab.dev_env_or_com?
check_namespace_plan? && (Rails.env.test? || ::Gitlab.dev_env_or_com?)
end
def elasticsearch_indexing
......
......@@ -85,6 +85,14 @@ describe ApplicationSetting do
before do
stub_application_setting(check_namespace_plan: check_namespace_plan_column)
allow(::Gitlab).to receive(:dev_env_or_com?) { gl_com }
# This stub was added in order to force a fallback to Gitlab.dev_env_or_com?
# call testing.
# Gitlab.dev_env_or_com? responds to `false` on test envs
# and we want to make sure we're still testing
# should_check_namespace_plan? method through the test-suite (see
# https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18461#note_69322821).
allow(Rails).to receive_message_chain(:env, :test?).and_return(false)
end
subject { setting.should_check_namespace_plan? }
......
......@@ -35,6 +35,6 @@ module Gitlab
end
def self.dev_env_or_com?
Rails.env.test? || Rails.env.development? || org? || com?
Rails.env.development? || org? || com?
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