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>2022-02-21 18:19:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-21 18:19:50 +0300
commit871e82b7c73283c2c71355e3258a6c9d3b8c0eda (patch)
treee895b27d313e8df94a160e4820093d0bc25d5a4c /spec/lib/gitlab_spec.rb
parentda9274a8f1939c135f3427947407680faa290052 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab_spec.rb')
-rw-r--r--spec/lib/gitlab_spec.rb68
1 files changed, 51 insertions, 17 deletions
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb
index 57a4bdc9bb5..cf3239da5f5 100644
--- a/spec/lib/gitlab_spec.rb
+++ b/spec/lib/gitlab_spec.rb
@@ -111,6 +111,12 @@ RSpec.describe Gitlab do
expect(described_class.com?).to eq false
end
+
+ it 'is true when GITLAB_SIMULATE_SAAS is true' do
+ stub_env('GITLAB_SIMULATE_SAAS', '1')
+
+ expect(described_class.com?).to eq true
+ end
end
describe '.com' do
@@ -210,13 +216,6 @@ RSpec.describe Gitlab do
expect(described_class.dev_env_org_or_com?).to eq true
end
- it 'is true when dev env' do
- allow(described_class).to receive_messages(com?: false, org?: false)
- stub_rails_env('development')
-
- expect(described_class.dev_env_org_or_com?).to eq true
- end
-
it 'is false when not dev, org or com' do
allow(described_class).to receive_messages(com?: false, org?: false)
@@ -225,23 +224,58 @@ RSpec.describe Gitlab do
end
describe '.dev_env_or_com?' do
- it 'is true when on .com' do
- allow(described_class).to receive(:com?).and_return(true)
+ it 'is correctly calling com?' do
+ expect(described_class).to receive(:com?).and_call_original
- expect(described_class.dev_env_or_com?).to eq true
+ expect(described_class.dev_env_or_com?).to eq false
end
+ end
- it 'is true when dev env' do
- allow(described_class).to receive(:com?).and_return(false)
- allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development'))
+ 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
- expect(described_class.dev_env_or_com?).to eq true
+ it 'is true when test env' do
+ expect(subject).to eq true
+ 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 or test' do
+ stub_rails_env('production')
+
+ expect(subject).to eq false
+ end
end
- it 'is false when not dev or com' do
- allow(described_class).to receive(:com?).and_return(false)
+ context 'when GITLAB_SIMULATE_SAAS is false' do
+ before do
+ stub_env('GITLAB_SIMULATE_SAAS', '0')
+ end
- expect(described_class.dev_env_or_com?).to eq false
+ 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