Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-26 18:09:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-26 18:09:04 +0300
commitee24c7d68f57a67754a5d1e2ea99f688029d14bd (patch)
tree8391744a26dd3f77c4bb1bbb55672ba0e066d969 /spec/lib/gitlab_spec.rb
parenta1c0b634f78f51389fd3ec390a1803afa3de49a2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab_spec.rb')
-rw-r--r--spec/lib/gitlab_spec.rb82
1 files changed, 60 insertions, 22 deletions
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb
index a554e0b26a8..c44bb64a5c0 100644
--- a/spec/lib/gitlab_spec.rb
+++ b/spec/lib/gitlab_spec.rb
@@ -81,6 +81,10 @@ RSpec.describe Gitlab do
describe '.com?' do
context 'when not simulating SaaS' do
+ before do
+ stub_env('GITLAB_SIMULATE_SAAS', '0')
+ end
+
it "is true when on #{Gitlab::Saas.com_url}" do
stub_config_setting(url: Gitlab::Saas.com_url)
@@ -114,31 +118,17 @@ RSpec.describe Gitlab do
end
end
- context 'when simulating SaaS' do
- before do
- stub_const('Gitlab::GITLAB_SIMULATE_SAAS', '1')
- end
-
- it 'is false in tests' do
- expect(described_class.com?).to eq false
- end
-
- it 'is true in development' do
- stub_rails_env('development')
+ it 'is true when GITLAB_SIMULATE_SAAS is true and in development' do
+ stub_rails_env('development')
+ stub_env('GITLAB_SIMULATE_SAAS', '1')
- expect(described_class.com?).to eq true
- end
+ expect(described_class.com?).to eq true
+ end
- # See ee/spec/lib/gitlab_spec.rb for EE-specific changes to this behavior.
- context 'in a production environment' do
- before do
- stub_rails_env('production')
- end
+ it 'is false when GITLAB_SIMULATE_SAAS is true and in test' do
+ stub_env('GITLAB_SIMULATE_SAAS', '1')
- it 'is false' do
- expect(described_class.com?).to eq false
- end
- end
+ expect(described_class.com?).to eq false
end
end
@@ -246,6 +236,54 @@ RSpec.describe Gitlab do
end
end
+ describe '.simulate_com?' do
+ subject { described_class.simulate_com? }
+
+ context 'when GITLAB_SIMULATE_SAAS is true' do
+ before do
+ stub_env('GITLAB_SIMULATE_SAAS', '1')
+ end
+
+ it 'is false when test env' do
+ expect(subject).to eq false
+ end
+
+ it 'is true when dev env' do
+ stub_rails_env('development')
+
+ expect(subject).to eq true
+ end
+
+ it 'is false when env is not dev' do
+ stub_rails_env('production')
+
+ expect(subject).to eq false
+ end
+ end
+
+ context 'when GITLAB_SIMULATE_SAAS is false' do
+ before do
+ stub_env('GITLAB_SIMULATE_SAAS', '0')
+ end
+
+ it 'is false when test env' do
+ expect(subject).to eq false
+ end
+
+ it 'is false when dev env' do
+ stub_rails_env('development')
+
+ expect(subject).to eq false
+ end
+
+ it 'is false when env is not dev or test' do
+ stub_rails_env('production')
+
+ expect(subject).to eq false
+ end
+ end
+ end
+
describe '.dev_or_test_env?' do
subject { described_class.dev_or_test_env? }