2018-03-29 09:49:08 +00:00
|
|
|
require 'fast_spec_helper'
|
|
|
|
|
|
|
|
require_dependency 'gitlab'
|
2016-04-12 18:39:08 +00:00
|
|
|
|
2017-07-10 14:24:02 +00:00
|
|
|
describe Gitlab do
|
2018-04-10 14:07:47 +00:00
|
|
|
describe '.root' do
|
|
|
|
it 'returns the root path of the app' do
|
|
|
|
expect(described_class.root).to eq(Pathname.new(File.expand_path('../..', __dir__)))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-04-12 18:39:08 +00:00
|
|
|
describe '.com?' do
|
|
|
|
it 'is true when on GitLab.com' do
|
|
|
|
stub_config_setting(url: 'https://gitlab.com')
|
|
|
|
|
|
|
|
expect(described_class.com?).to eq true
|
|
|
|
end
|
|
|
|
|
2016-06-13 21:43:29 +00:00
|
|
|
it 'is true when on staging' do
|
|
|
|
stub_config_setting(url: 'https://staging.gitlab.com')
|
|
|
|
|
|
|
|
expect(described_class.com?).to eq true
|
|
|
|
end
|
|
|
|
|
2018-04-13 17:20:29 +00:00
|
|
|
it 'is true when on other gitlab subdomain' do
|
|
|
|
stub_config_setting(url: 'https://example.gitlab.com')
|
|
|
|
|
|
|
|
expect(described_class.com?).to eq true
|
|
|
|
end
|
|
|
|
|
2016-04-12 18:39:08 +00:00
|
|
|
it 'is false when not on GitLab.com' do
|
|
|
|
stub_config_setting(url: 'http://example.com')
|
|
|
|
|
|
|
|
expect(described_class.com?).to eq false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|