Skip to content
代码片段 群组 项目
未验证 提交 f429858e 编辑于 作者: Smriti Garg's avatar Smriti Garg 提交者: GitLab
浏览文件

Merge branch 'duo-group-subscription-bug' into 'master'

No related branches found
No related tags found
无相关合并请求
......@@ -3,6 +3,7 @@
module EE
module GroupsHelper
extend ::Gitlab::Utils::Override
include ::Gitlab::Utils::StrongMemoize
include ::GitlabSubscriptions::CodeSuggestionsHelper
include ::Subscriptions::HandRaiseLeadsHelper
include ::Nav::GitlabDuoUsageSettingsPage
......@@ -115,7 +116,22 @@ def code_suggestions_usage_app_data(group)
hand_raise_lead: code_suggestions_usage_app_hand_raise_lead_data,
is_free_namespace: group.has_free_or_no_subscription?.to_s,
buy_subscription_path: group_billings_path(group)
}.merge(duo_pro_trial_link(group), active_duo_pro_trial_data(group))
}.merge(duo_pro_trial_link(group), active_duo_pro_trial_data(group), active_subscription_data(group))
end
def active_subscription_data(group)
return {} unless group_gitlab_subscription(group)
{
subscription_start_date: group_gitlab_subscription(group).start_date,
subscription_end_date: group_gitlab_subscription(group).end_date
}
end
def group_gitlab_subscription(group)
strong_memoize(:group_gitlab_subscription) do
group.gitlab_subscription
end
end
def active_duo_pro_trial_data(group)
......
......@@ -499,6 +499,29 @@
end
end
describe '#active_subscription_data' do
context 'when there is a current subscription', :saas do
let(:subscription) { create(:gitlab_subscription, namespace: group) }
before do
group.gitlab_subscription = subscription
end
it 'returns the subscription start date and end date' do
expect(helper.active_subscription_data(group)).to eq({
subscription_start_date: subscription.start_date,
subscription_end_date: subscription.end_date
})
end
end
context 'when there is no current subscription' do
it 'returns empty' do
expect(helper.active_subscription_data(group)).to eq({})
end
end
end
describe '#active_duo_pro_trial_data' do
context 'when an active duo pro trial exists' do
let(:trial_add_on) { create(:gitlab_subscription_add_on_purchase, :gitlab_duo_pro, :trial, namespace: group) }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册