Skip to content
代码片段 群组 项目
未验证 提交 52f83439 编辑于 作者: Buck O'Leary's avatar Buck O'Leary 提交者: GitLab
浏览文件

Apply 1 suggestion

Co-Authored by @sselhorn
上级 4841309f
No related branches found
No related tags found
无相关合并请求
...@@ -23,7 +23,11 @@ def render_dashboard_ultimate_trial(user) ...@@ -23,7 +23,11 @@ def render_dashboard_ultimate_trial(user)
!user.owns_paid_namespace? && !user.owns_paid_namespace? &&
user.owns_group_without_trial? user.owns_group_without_trial?
render 'shared/ultimate_trial_callout_content' if ::Feature.enabled?(:duo_enterprise_trials, user)
render 'shared/ultimate_with_enterprise_trial_callout_content'
else
render 'shared/ultimate_trial_callout_content'
end
end end
def render_two_factor_auth_recovery_settings_check def render_two_factor_auth_recovery_settings_check
......
- callout = local_assigns.fetch(:callout, Users::CalloutsHelper::ULTIMATE_TRIAL)
- banner_title = 'ultimate_banner'
= render Pajamas::BannerComponent.new(svg_path: 'illustrations/gitlab_logo.svg', banner_options: { class: 'gl-mt-6 js-gold-trial-callout', data: { track_action: 'render', track_label: banner_title, uid: 'trial_callout_dismissed', feature_id: callout, dismiss_endpoint: callouts_path, testid: 'start-trial-banner' } }, close_options: { class: 'js-close', data: { track_action: 'dismiss_banner', track_label: banner_title }, 'aria-label': _('Dismiss trial promotion') }) do |c|
- c.with_title do
= _('Free Ultimate Trial with GitLab Duo Enterprise')
- c.with_primary_action do
= link_button_to _('Start your free trial'), new_trial_path(glm_source: glm_source, glm_content: 'gold-callout'), target: '_blank', rel: 'noopener noreferrer', data: { track_action: 'click_button', track_label: 'start_your_trial', track_property: banner_title }, variant: :confirm
%p= _('Get access to all Ultimate and GitLab Duo AI-powered features, free for 60 days. No credit card required.')
...@@ -7,49 +7,74 @@ ...@@ -7,49 +7,74 @@
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
describe '#render_dashboard_ultimate_trial', :saas do describe '#render_dashboard_ultimate_trial', :saas do
let_it_be(:namespace) { create(:namespace) } let_it_be(:namespace) { build_stubbed(:namespace) }
let_it_be(:ultimate_plan) { create(:ultimate_plan) } let_it_be(:user) { namespace.owner }
let(:user) { namespace.owner } let(:show_ultimate_trial?) { true }
let(:user_default_dashboard?) { true }
where(:owns_group_without_trial?, :show_ultimate_trial?, :user_default_dashboard?, :has_no_trial_or_paid_plan?, :should_render?) do let(:owns_paid_namespace?) { false }
true | true | true | true | true let(:owns_group_without_trial?) { true }
true | true | true | false | false let(:duo_enterprise_trials_enabled?) { true }
true | true | false | true | false
true | false | true | true | false let(:render) { helper.render_dashboard_ultimate_trial(user) }
true | true | false | false | false
true | false | false | true | false before do
true | false | true | false | false allow(helper).to receive(:show_ultimate_trial?).with(user, described_class::ULTIMATE_TRIAL).and_return(show_ultimate_trial?)
true | false | false | false | false allow(helper).to receive(:user_default_dashboard?).with(user).and_return(user_default_dashboard?)
false | true | true | true | false allow(user).to receive(:owns_paid_namespace?).and_return(owns_paid_namespace?)
false | true | true | false | false allow(user).to receive(:owns_group_without_trial?).and_return(owns_group_without_trial?)
false | true | false | true | false stub_feature_flags(duo_enterprise_trials: duo_enterprise_trials_enabled?)
false | false | true | true | false
false | true | false | false | false
false | false | false | true | false
false | false | true | false | false
false | false | false | false | false
end end
with_them do context 'when all conditions are met' do
before do it 'renders the ultimate_with_enterprise_trial_callout_content' do
allow(helper).to receive(:show_ultimate_trial?) { show_ultimate_trial? } expect(helper).to receive(:render).with('shared/ultimate_with_enterprise_trial_callout_content')
allow(helper).to receive(:user_default_dashboard?) { user_default_dashboard? } render
allow(user).to receive(:owns_group_without_trial?) { owns_group_without_trial? } end
end
unless has_no_trial_or_paid_plan? context 'when duo_enterprise_trials feature flag is disabled' do
create(:gitlab_subscription, hosted_plan: ultimate_plan, namespace: namespace) let(:duo_enterprise_trials_enabled?) { false }
end
it 'renders the ultimate_trial_callout_content' do
expect(helper).to receive(:render).with('shared/ultimate_trial_callout_content')
render
end end
end
it do context 'when show_ultimate_trial? is false' do
if should_render? let(:show_ultimate_trial?) { false }
expect(helper).to receive(:render).with('shared/ultimate_trial_callout_content')
else it 'does not render any content' do
expect(helper).not_to receive(:render) expect(helper).not_to receive(:render)
end render
end
end
context 'when user_default_dashboard? is false' do
let(:user_default_dashboard?) { false }
it 'does not render any content' do
expect(helper).not_to receive(:render)
render
end
end
context 'when user owns a paid namespace' do
let(:owns_paid_namespace?) { true }
it 'does not render any content' do
expect(helper).not_to receive(:render)
render
end
end
context 'when user does not own a group without trial' do
let(:owns_group_without_trial?) { false }
helper.render_dashboard_ultimate_trial(user) it 'does not render any content' do
expect(helper).not_to receive(:render)
render
end end
end end
end end
......
...@@ -23773,6 +23773,9 @@ msgstr "" ...@@ -23773,6 +23773,9 @@ msgstr ""
msgid "Free Trial of GitLab.com Ultimate" msgid "Free Trial of GitLab.com Ultimate"
msgstr "" msgstr ""
   
msgid "Free Ultimate Trial with GitLab Duo Enterprise"
msgstr ""
msgid "Free groups are limited to %{free_user_limit} member and the remaining members will get a status of over-limit and lose access to the group." msgid "Free groups are limited to %{free_user_limit} member and the remaining members will get a status of over-limit and lose access to the group."
msgid_plural "Free groups are limited to %{free_user_limit} members and the remaining members will get a status of over-limit and lose access to the group." msgid_plural "Free groups are limited to %{free_user_limit} members and the remaining members will get a status of over-limit and lose access to the group."
msgstr[0] "" msgstr[0] ""
...@@ -24436,6 +24439,9 @@ msgstr "" ...@@ -24436,6 +24439,9 @@ msgstr ""
msgid "Get a support subscription" msgid "Get a support subscription"
msgstr "" msgstr ""
   
msgid "Get access to all Ultimate and GitLab Duo AI-powered features, free for 60 days. No credit card required."
msgstr ""
msgid "Get free trial" msgid "Get free trial"
msgstr "" msgstr ""
   
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册