diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-06-20 16:44:39 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-06-20 16:44:39 +0000 |
commit | d98bae878f95e27f235d6c674eab839fe5de005a (patch) | |
tree | c2d3fe172a556b5264753f5127b9fc35c86da6ea /spec | |
parent | c6eb18ee0fe1b887438da87f25fc2f2a852dd393 (diff) | |
parent | 0e41564762cd74c6cbf938dcc319c3b77a891dc7 (diff) | |
download | gitlab-ce-d98bae878f95e27f235d6c674eab839fe5de005a.tar.gz |
Merge branch 'config-yaml-differences' into 'master'
Backport changes made by EE to various YAML configuration files
See merge request gitlab-org/gitlab-ce!29606
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fast_spec_helper.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab_spec.rb | 32 |
2 files changed, 31 insertions, 2 deletions
diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb index 0b5ab16ad71..91ef7653822 100644 --- a/spec/fast_spec_helper.rb +++ b/spec/fast_spec_helper.rb @@ -3,6 +3,7 @@ require 'bundler/setup' ENV['GITLAB_ENV'] = 'test' ENV['IN_MEMORY_APPLICATION_SETTINGS'] = 'true' +require 'active_support/dependencies' require_relative '../config/settings' require_relative 'support/rspec' require 'active_support/all' 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 |