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-25 21:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-25 21:08:56 +0300
commitff549ec680715e4ea1daf0cee457f29dfe3b6062 (patch)
tree823fc28718a1278025ee2d88c1368958befec4da /spec/lib/gitlab_spec.rb
parentec558ad8ed732ff6f8a89aa3651eb92c27c50deb (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, 22 insertions, 60 deletions
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb
index c44bb64a5c0..a554e0b26a8 100644
--- a/spec/lib/gitlab_spec.rb
+++ b/spec/lib/gitlab_spec.rb
@@ -81,10 +81,6 @@ 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)
@@ -118,17 +114,31 @@ RSpec.describe Gitlab do
end
end
- it 'is true when GITLAB_SIMULATE_SAAS is true and in development' do
- stub_rails_env('development')
- stub_env('GITLAB_SIMULATE_SAAS', '1')
+ context 'when simulating SaaS' do
+ before do
+ stub_const('Gitlab::GITLAB_SIMULATE_SAAS', '1')
+ end
- expect(described_class.com?).to eq true
- 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 false when GITLAB_SIMULATE_SAAS is true and in test' do
- stub_env('GITLAB_SIMULATE_SAAS', '1')
+ expect(described_class.com?).to eq true
+ end
- expect(described_class.com?).to eq false
+ # 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' do
+ expect(described_class.com?).to eq false
+ end
+ end
end
end
@@ -236,54 +246,6 @@ 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? }