Commit 77c35ac8 authored by Nick Thomas's avatar Nick Thomas

Merge branch '82-add-new-onboarding-to-flipper-a-b-testing' into 'master'

Add new onboarding to flipper A/B testing

See merge request gitlab-org/gitlab-ce!30125
parents 9ae25ed1 e00b7586
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class Dashboard::ProjectsController < Dashboard::ApplicationController class Dashboard::ProjectsController < Dashboard::ApplicationController
include ParamsBackwardCompatibility include ParamsBackwardCompatibility
include RendersMemberAccess include RendersMemberAccess
include OnboardingExperimentHelper
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) } prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
before_action :set_non_archived_param before_action :set_non_archived_param
......
# frozen_string_literal: true
module OnboardingExperimentHelper
def allow_access_to_onboarding?
::Gitlab.com? && Feature.enabled?(:user_onboarding)
end
end
# frozen_string_literal: true
require 'spec_helper'
describe OnboardingExperimentHelper, type: :helper do
describe '.allow_access_to_onboarding?' do
context "when we're not gitlab.com" do
it 'returns false' do
allow(::Gitlab).to receive(:com?).and_return(false)
expect(helper.allow_access_to_onboarding?).to be(false)
end
end
context "when we're gitlab.com" do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment