diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-06-13 15:18:01 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-06-20 15:51:49 +0300 |
commit | 0e41564762cd74c6cbf938dcc319c3b77a891dc7 (patch) | |
tree | 1a1a67a7eb29e4e42de345fbd70a86c6dcd35477 /spec/lib/gitlab_spec.rb | |
parent | 3cd038e3046a18e38e25d7904cca9e38ea6565dd (diff) |
Backport gitlab.yml.example from EE
To make this happen, we need to conditionally add the group_saml
strategy when running tests, but only on EE. This requires some changes
to Gitlab.ee? so that it can be used before/without loading the Rails
environment. We also have to change how we require a few files, so this
can run outside of Rails.
Diffstat (limited to 'spec/lib/gitlab_spec.rb')
-rw-r--r-- | spec/lib/gitlab_spec.rb | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index e075904b0cc..82b0e819063 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -97,14 +97,42 @@ describe Gitlab do end describe '.ee?' do + before do + described_class.instance_variable_set(:@is_ee, nil) + end + + after do + described_class.instance_variable_set(:@is_ee, nil) + end + it 'returns true when using Enterprise Edition' do - stub_const('License', Class.new) + root = Pathname.new('dummy') + license_path = double(:path, exist?: true) + + allow(described_class) + .to receive(:root) + .and_return(root) + + allow(root) + .to receive(:join) + .with('ee/app/models/license.rb') + .and_return(license_path) expect(described_class.ee?).to eq(true) end it 'returns false when using Community Edition' do - hide_const('License') + root = double(:path) + license_path = double(:path, exists?: false) + + allow(described_class) + .to receive(:root) + .and_return(Pathname.new('dummy')) + + allow(root) + .to receive(:join) + .with('ee/app/models/license.rb') + .and_return(license_path) expect(described_class.ee?).to eq(false) end |