Commit a2982624 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix trial callout to use the correct plan

namespaces.plan_id is unused and we should use the plan in
the gitlab_subscriptions table
parent 6cf6d3ec
......@@ -5,7 +5,7 @@
- if namespace.eligible_for_trial?
= s_("BillingPlans|Learn more about each plan by reading our %{faq_link}, or start a free 30-day trial of GitLab.com Gold.").html_safe % { faq_link: faq_link }
- elsif namespace.trial_active?
= s_("BillingPlans|Your GitLab.com %{plan} trial will <strong>expire after %{expiration_date}</strong>. You can retain access to the %{plan} features by upgrading below.").html_safe % { plan: namespace.plan&.title, expiration_date: namespace.trial_ends_on }
= s_("BillingPlans|Your GitLab.com %{plan} trial will <strong>expire after %{expiration_date}</strong>. You can retain access to the %{plan} features by upgrading below.").html_safe % { plan: namespace.gitlab_subscription&.plan_title, expiration_date: namespace.trial_ends_on }
- elsif namespace.trial_expired?
= s_("BillingPlans|Your GitLab.com trial expired on %{expiration_date}. You can restore access to the features at any time by upgrading below.").html_safe % { expiration_date: namespace.trial_ends_on }
- else
......
......@@ -201,7 +201,10 @@ describe EE::UserCalloutsHelper do
allow(helper).to receive(:show_gold_trial?) { show_gold_trial? }
allow(helper).to receive(:user_default_dashboard?) { user_default_dashboard? }
allow(helper).to receive(:has_some_namespaces_with_no_trials?) { has_some_namespaces_with_no_trials? }
namespace.update(plan: gold_plan) unless has_no_trial_or_gold_plan?
unless has_no_trial_or_gold_plan?
create(:gitlab_subscription, hosted_plan: gold_plan, namespace: namespace)
end
end
it do
......
......@@ -6,18 +6,12 @@ describe 'shared/billings/_trial_status.html.haml' do
include ApplicationHelper
let_it_be(:group) { create(:group) }
let_it_be(:gitlab_subscription) { create(:gitlab_subscription, namespace: group) }
let(:plan) { nil }
let(:trial_ends_on) { nil }
let(:trial) { false }
before do
gitlab_subscription.update(
hosted_plan: plan,
trial_ends_on: trial_ends_on,
trial: trial
)
group.update(plan: plan)
create(:gitlab_subscription, namespace: group, hosted_plan: plan, trial_ends_on: trial_ends_on, trial: trial)
end
context 'when not eligible for trial' do
......
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