Commit 1148f1cd authored by Thong Kuah's avatar Thong Kuah

Merge branch '349713-discussion-avoid-gitlab-dev_env_or_com3' into 'master'

Remove test environment from simulate saas consideration

See merge request gitlab-org/gitlab!82029
parents 86c532a9 3388a338
...@@ -50,7 +50,7 @@ module Gitlab ...@@ -50,7 +50,7 @@ module Gitlab
HTTP_PROXY_ENV_VARS = %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).freeze HTTP_PROXY_ENV_VARS = %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).freeze
def self.simulate_com? def self.simulate_com?
return false unless Rails.env.test? || Rails.env.development? return false unless Rails.env.development?
Gitlab::Utils.to_boolean(ENV['GITLAB_SIMULATE_SAAS']) Gitlab::Utils.to_boolean(ENV['GITLAB_SIMULATE_SAAS'])
end end
......
...@@ -112,11 +112,18 @@ RSpec.describe Gitlab do ...@@ -112,11 +112,18 @@ RSpec.describe Gitlab do
expect(described_class.com?).to eq false expect(described_class.com?).to eq false
end end
it 'is true when GITLAB_SIMULATE_SAAS is true' do it 'is true when GITLAB_SIMULATE_SAAS is true and in development' do
stub_rails_env('development')
stub_env('GITLAB_SIMULATE_SAAS', '1') stub_env('GITLAB_SIMULATE_SAAS', '1')
expect(described_class.com?).to eq true expect(described_class.com?).to eq true
end end
it 'is false when GITLAB_SIMULATE_SAAS is true and in test' do
stub_env('GITLAB_SIMULATE_SAAS', '1')
expect(described_class.com?).to eq false
end
end end
describe '.com' do describe '.com' do
...@@ -239,8 +246,8 @@ RSpec.describe Gitlab do ...@@ -239,8 +246,8 @@ RSpec.describe Gitlab do
stub_env('GITLAB_SIMULATE_SAAS', '1') stub_env('GITLAB_SIMULATE_SAAS', '1')
end end
it 'is true when test env' do it 'is false when test env' do
expect(subject).to eq true expect(subject).to eq false
end end
it 'is true when dev env' do it 'is true when dev env' do
...@@ -249,7 +256,7 @@ RSpec.describe Gitlab do ...@@ -249,7 +256,7 @@ RSpec.describe Gitlab do
expect(subject).to eq true expect(subject).to eq true
end end
it 'is false when env is not dev or test' do it 'is false when env is not dev' do
stub_rails_env('production') stub_rails_env('production')
expect(subject).to eq false expect(subject).to eq false
......
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