diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/helpers/learn_gitlab_helper_spec.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/helpers/learn_gitlab_helper_spec.rb')
-rw-r--r-- | spec/helpers/learn_gitlab_helper_spec.rb | 56 |
1 files changed, 6 insertions, 50 deletions
diff --git a/spec/helpers/learn_gitlab_helper_spec.rb b/spec/helpers/learn_gitlab_helper_spec.rb index cf0d329c36f..1159fd96d59 100644 --- a/spec/helpers/learn_gitlab_helper_spec.rb +++ b/spec/helpers/learn_gitlab_helper_spec.rb @@ -53,7 +53,7 @@ RSpec.describe LearnGitlabHelper do end end - describe '.learn_gitlab_experiment_enabled?' do + describe '.learn_gitlab_enabled?' do using RSpec::Parameterized::TableSyntax let_it_be(:user) { create(:user) } @@ -61,19 +61,16 @@ RSpec.describe LearnGitlabHelper do let(:params) { { namespace_id: project.namespace.to_param, project_id: project } } - subject { helper.learn_gitlab_experiment_enabled?(project) } + subject { helper.learn_gitlab_enabled?(project) } - where(:experiment_a, :experiment_b, :onboarding, :learn_gitlab_available, :result) do - true | false | true | true | true - false | true | true | true | true - false | false | true | true | false - true | true | true | false | false - true | true | false | true | false + where(:onboarding, :learn_gitlab_available, :result) do + true | true | true + true | false | false + false | true | false end with_them do before do - stub_experiment_for_subject(learn_gitlab_a: experiment_a, learn_gitlab_b: experiment_b) allow(OnboardingProgress).to receive(:onboarding?).with(project.namespace).and_return(onboarding) allow_next(LearnGitlab::Project, user).to receive(:available?).and_return(learn_gitlab_available) end @@ -88,10 +85,6 @@ RSpec.describe LearnGitlabHelper do end context 'when not signed in' do - before do - stub_experiment_for_subject(learn_gitlab_a: true, learn_gitlab_b: true) - end - it { is_expected.to eq(false) } end end @@ -106,41 +99,4 @@ RSpec.describe LearnGitlabHelper do expect(sections.values.map { |section| section.keys }).to eq([[:svg]] * 3) end end - - describe '.learn_gitlab_experiment_tracking_category' do - using RSpec::Parameterized::TableSyntax - - let_it_be(:user) { create(:user) } - - subject { helper.learn_gitlab_experiment_tracking_category } - - where(:experiment_a, :experiment_b, :result) do - false | false | nil - false | true | 'Growth::Activation::Experiment::LearnGitLabB' - true | false | 'Growth::Conversion::Experiment::LearnGitLabA' - true | true | 'Growth::Conversion::Experiment::LearnGitLabA' - end - - with_them do - before do - stub_experiment_for_subject(learn_gitlab_a: experiment_a, learn_gitlab_b: experiment_b) - end - - context 'when signed in' do - before do - sign_in(user) - end - - it { is_expected.to eq(result) } - end - end - - context 'when not signed in' do - before do - stub_experiment_for_subject(learn_gitlab_a: true, learn_gitlab_b: true) - end - - it { is_expected.to eq(nil) } - end - end end |