Commit 87aac31d authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch 'astoicescu-remove-limit-of-features-on-billing-page' into 'master'

Remove limit of four features per plan

See merge request gitlab-org/gitlab!51264
parents de2f721d 6cc18585
---
title: Remove limit of four features per plan
merge_request: 51264
author:
type: changed
...@@ -45,10 +45,10 @@ module BillingPlansHelper ...@@ -45,10 +45,10 @@ module BillingPlansHelper
} }
end end
def plan_feature_short_list(plan) def plan_feature_list(plan)
return [] unless plan.features return [] unless plan.features
plan.features.sort_by! { |feature| feature.highlight ? 0 : 1 }[0...4] plan.features.sort_by! { |feature| feature.highlight ? 0 : 1 }
end end
def plan_purchase_or_upgrade_url(group, plan) def plan_purchase_or_upgrade_url(group, plan)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
%hr.gl-my-3 %hr.gl-my-3
%ul.unstyled-list %ul.unstyled-list
- plan_feature_short_list(plan).each do |feature| - plan_feature_list(plan).each do |feature|
- feature_class = "gl-p-0!" - feature_class = "gl-p-0!"
- if feature.highlight - if feature.highlight
- feature_class += " gl-font-weight-bold" - feature_class += " gl-font-weight-bold"
......
...@@ -152,6 +152,18 @@ RSpec.describe BillingPlansHelper do ...@@ -152,6 +152,18 @@ RSpec.describe BillingPlansHelper do
end end
end end
describe '#plan_feature_list' do
let(:plan) do
Hashie::Mash.new(features: (1..3).map { |i| { title: "feat 0#{i}", highlight: i.even? } })
end
it 'returns features list sorted by highlight attribute' do
expect(helper.plan_feature_list(plan)).to eq([{ 'title' => 'feat 02', 'highlight' => true },
{ 'title' => 'feat 01', 'highlight' => false },
{ 'title' => 'feat 03', 'highlight' => false }])
end
end
describe '#seats_data_last_update_info' do describe '#seats_data_last_update_info' do
before do before do
allow(UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker).to receive(:last_enqueue_time).and_return(enqueue_time) allow(UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker).to receive(:last_enqueue_time).and_return(enqueue_time)
......
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