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)
!user.owns_paid_namespace? &&
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
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 @@
using RSpec::Parameterized::TableSyntax
describe '#render_dashboard_ultimate_trial', :saas do
let_it_be(:namespace) { create(:namespace) }
let_it_be(:ultimate_plan) { create(:ultimate_plan) }
let(:user) { namespace.owner }
where(:owns_group_without_trial?, :show_ultimate_trial?, :user_default_dashboard?, :has_no_trial_or_paid_plan?, :should_render?) do
true | true | true | true | true
true | true | true | false | false
true | true | false | true | false
true | false | true | true | false
true | true | false | false | false
true | false | false | true | false
true | false | true | false | false
true | false | false | false | false
false | true | true | true | false
false | true | true | false | false
false | true | false | true | false
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
let_it_be(:namespace) { build_stubbed(:namespace) }
let_it_be(:user) { namespace.owner }
let(:show_ultimate_trial?) { true }
let(:user_default_dashboard?) { true }
let(:owns_paid_namespace?) { false }
let(:owns_group_without_trial?) { true }
let(:duo_enterprise_trials_enabled?) { true }
let(:render) { helper.render_dashboard_ultimate_trial(user) }
before do
allow(helper).to receive(:show_ultimate_trial?).with(user, described_class::ULTIMATE_TRIAL).and_return(show_ultimate_trial?)
allow(helper).to receive(:user_default_dashboard?).with(user).and_return(user_default_dashboard?)
allow(user).to receive(:owns_paid_namespace?).and_return(owns_paid_namespace?)
allow(user).to receive(:owns_group_without_trial?).and_return(owns_group_without_trial?)
stub_feature_flags(duo_enterprise_trials: duo_enterprise_trials_enabled?)
end
with_them do
before do
allow(helper).to receive(:show_ultimate_trial?) { show_ultimate_trial? }
allow(helper).to receive(:user_default_dashboard?) { user_default_dashboard? }
allow(user).to receive(:owns_group_without_trial?) { owns_group_without_trial? }
context 'when all conditions are met' do
it 'renders the ultimate_with_enterprise_trial_callout_content' do
expect(helper).to receive(:render).with('shared/ultimate_with_enterprise_trial_callout_content')
render
end
end
unless has_no_trial_or_paid_plan?
create(:gitlab_subscription, hosted_plan: ultimate_plan, namespace: namespace)
end
context 'when duo_enterprise_trials feature flag is disabled' do
let(:duo_enterprise_trials_enabled?) { false }
it 'renders the ultimate_trial_callout_content' do
expect(helper).to receive(:render).with('shared/ultimate_trial_callout_content')
render
end
end
it do
if should_render?
expect(helper).to receive(:render).with('shared/ultimate_trial_callout_content')
else
expect(helper).not_to receive(:render)
end
context 'when show_ultimate_trial? is false' do
let(:show_ultimate_trial?) { false }
it 'does not render any content' do
expect(helper).not_to receive(:render)
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
......
......@@ -23773,6 +23773,9 @@ msgstr ""
msgid "Free Trial of GitLab.com Ultimate"
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_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] ""
......@@ -24436,6 +24439,9 @@ msgstr ""
msgid "Get a support subscription"
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"
msgstr ""
 
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册