2019-06-26 23:48:04 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe OnboardingExperimentHelper, type: :helper do
|
|
|
|
describe '.allow_access_to_onboarding?' do
|
2019-09-13 09:26:31 -04:00
|
|
|
context "when we're not gitlab.com or dev env" do
|
2019-06-26 23:48:04 -04:00
|
|
|
it 'returns false' do
|
2019-09-13 09:26:31 -04:00
|
|
|
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(false)
|
2019-06-26 23:48:04 -04:00
|
|
|
|
|
|
|
expect(helper.allow_access_to_onboarding?).to be(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-09-13 09:26:31 -04:00
|
|
|
context "when we're gitlab.com or dev env" do
|
2019-06-26 23:48:04 -04:00
|
|
|
before do
|
2019-09-13 09:26:31 -04:00
|
|
|
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(true)
|
2019-06-26 23:48:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'and the :user_onboarding feature is not enabled' do
|
|
|
|
it 'returns false' do
|
|
|
|
stub_feature_flags(user_onboarding: false)
|
|
|
|
|
|
|
|
expect(helper.allow_access_to_onboarding?).to be(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'and the :user_onboarding feature is enabled' do
|
|
|
|
it 'returns true' do
|
|
|
|
stub_feature_flags(user_onboarding: true)
|
|
|
|
allow(helper).to receive(:current_user).and_return(create(:user))
|
|
|
|
|
|
|
|
expect(helper.allow_access_to_onboarding?).to be(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|