Commit e478477e authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch '321364-replace-silver-with-premium-rspec' into 'master'

Update codebase with use of new "Premium" plan along with the deprecated "Silver" plan

See merge request gitlab-org/gitlab!54680
parents 938d772a 7530308f
...@@ -19,7 +19,7 @@ it should be restricted on namespace scope. ...@@ -19,7 +19,7 @@ it should be restricted on namespace scope.
1. Add the feature symbol on `EES_FEATURES`, `EEP_FEATURES` or `EEU_FEATURES` constants in 1. Add the feature symbol on `EES_FEATURES`, `EEP_FEATURES` or `EEU_FEATURES` constants in
`ee/app/models/license.rb`. Note on `ee/app/models/ee/namespace.rb` that _Bronze_ GitLab.com `ee/app/models/license.rb`. Note on `ee/app/models/ee/namespace.rb` that _Bronze_ GitLab.com
features maps to on-premise _EES_, _Silver_ to _EEP_ and _Gold_ to _EEU_. features maps to on-premise _EES_, _Silver/Premium_ to _EEP_ and _Gold/Ultimate_ to _EEU_.
1. Check using: 1. Check using:
```ruby ```ruby
......
...@@ -104,7 +104,7 @@ module Gitlab ...@@ -104,7 +104,7 @@ module Gitlab
case plan_name case plan_name
when 'Gold', 'Ultimate' when 'Gold', 'Ultimate'
_('After that, you will not be able to use merge approvals or epics as well as many security features.') _('After that, you will not be able to use merge approvals or epics as well as many security features.')
when 'Silver' when 'Premium', 'Silver'
_('After that, you will not be able to use merge approvals or epics as well as many other features.') _('After that, you will not be able to use merge approvals or epics as well as many other features.')
else else
_('After that, you will not be able to use merge approvals or code quality as well as many other features.') _('After that, you will not be able to use merge approvals or code quality as well as many other features.')
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Changes GL.com plan for group' do RSpec.describe 'Changes GL.com plan for group' do
include WaitForRequests include WaitForRequests
let!(:silver_plan) { create(:silver_plan) } let!(:premium_plan) { create(:premium_plan) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
before do before do
...@@ -28,7 +28,7 @@ RSpec.describe 'Changes GL.com plan for group' do ...@@ -28,7 +28,7 @@ RSpec.describe 'Changes GL.com plan for group' do
click_button('Save changes') click_button('Save changes')
expect(page).to have_content('Plan: Premium (Formerly Silver)') expect(page).to have_content('Plan: Premium')
end end
end end
...@@ -45,7 +45,7 @@ RSpec.describe 'Changes GL.com plan for group' do ...@@ -45,7 +45,7 @@ RSpec.describe 'Changes GL.com plan for group' do
click_button('Save changes') click_button('Save changes')
expect(page).to have_content('Plan: Premium (Formerly Silver)') expect(page).to have_content('Plan: Premium')
end end
end end
end end
...@@ -10,7 +10,7 @@ RSpec.describe 'Billing plan pages', :feature do ...@@ -10,7 +10,7 @@ RSpec.describe 'Billing plan pages', :feature do
let(:namespace) { user.namespace } let(:namespace) { user.namespace }
let(:free_plan) { create(:free_plan) } let(:free_plan) { create(:free_plan) }
let(:bronze_plan) { create(:bronze_plan) } let(:bronze_plan) { create(:bronze_plan) }
let(:silver_plan) { create(:silver_plan) } let(:premium_plan) { create(:premium_plan) }
let(:ultimate_plan) { create(:ultimate_plan) } let(:ultimate_plan) { create(:ultimate_plan) }
let(:plans_data) do let(:plans_data) do
Gitlab::Json.parse(File.read(Rails.root.join('ee/spec/fixtures/gitlab_com_plans.json'))).map do |data| Gitlab::Json.parse(File.read(Rails.root.join('ee/spec/fixtures/gitlab_com_plans.json'))).map do |data|
...@@ -56,7 +56,7 @@ RSpec.describe 'Billing plan pages', :feature do ...@@ -56,7 +56,7 @@ RSpec.describe 'Billing plan pages', :feature do
# see ApplicationHelper#contact_sales_url # see ApplicationHelper#contact_sales_url
contact_sales_url = 'https://about.gitlab.com/sales' contact_sales_url = 'https://about.gitlab.com/sales'
page.within('.content') do page.within('.content') do
expect(page).to have_link('Contact sales', href: %r{#{contact_sales_url}\?test=inappcontactsales(bronze|silver|gold)}) expect(page).to have_link('Contact sales', href: %r{#{contact_sales_url}\?test=inappcontactsales(bronze|premium|gold)})
end end
end end
end end
...@@ -187,8 +187,8 @@ RSpec.describe 'Billing plan pages', :feature do ...@@ -187,8 +187,8 @@ RSpec.describe 'Billing plan pages', :feature do
it_behaves_like 'plan with subscription table' it_behaves_like 'plan with subscription table'
end end
context 'on silver plan' do context 'on premium plan' do
let(:plan) { silver_plan } let(:plan) { premium_plan }
let!(:subscription) do let!(:subscription) do
create(:gitlab_subscription, namespace: namespace, hosted_plan: plan, seats: 15) create(:gitlab_subscription, namespace: namespace, hosted_plan: plan, seats: 15)
......
...@@ -15,7 +15,7 @@ RSpec.describe ProjectsFinder do ...@@ -15,7 +15,7 @@ RSpec.describe ProjectsFinder do
let_it_be(:ultimate_project) { create_project(:ultimate_plan) } let_it_be(:ultimate_project) { create_project(:ultimate_plan) }
let_it_be(:ultimate_project2) { create_project(:ultimate_plan) } let_it_be(:ultimate_project2) { create_project(:ultimate_plan) }
let_it_be(:silver_project) { create_project(:silver_plan) } let_it_be(:premium_project) { create_project(:premium_plan) }
let_it_be(:no_plan_project) { create_project(nil) } let_it_be(:no_plan_project) { create_project(nil) }
context 'with ultimate plan' do context 'with ultimate plan' do
...@@ -25,9 +25,9 @@ RSpec.describe ProjectsFinder do ...@@ -25,9 +25,9 @@ RSpec.describe ProjectsFinder do
end end
context 'with multiple plans' do context 'with multiple plans' do
let(:plans) { %w[ultimate silver] } let(:plans) { %w[ultimate premium] }
it { is_expected.to contain_exactly(ultimate_project, ultimate_project2, silver_project) } it { is_expected.to contain_exactly(ultimate_project, ultimate_project2, premium_project) }
end end
context 'with other plans' do context 'with other plans' do
...@@ -39,13 +39,13 @@ RSpec.describe ProjectsFinder do ...@@ -39,13 +39,13 @@ RSpec.describe ProjectsFinder do
context 'without plans' do context 'without plans' do
let(:plans) { nil } let(:plans) { nil }
it { is_expected.to contain_exactly(ultimate_project, ultimate_project2, silver_project, no_plan_project) } it { is_expected.to contain_exactly(ultimate_project, ultimate_project2, premium_project, no_plan_project) }
end end
context 'with empty plans' do context 'with empty plans' do
let(:plans) { [] } let(:plans) { [] }
it { is_expected.to contain_exactly(ultimate_project, ultimate_project2, silver_project, no_plan_project) } it { is_expected.to contain_exactly(ultimate_project, ultimate_project2, premium_project, no_plan_project) }
end end
context 'filter by aimed for deletion' do context 'filter by aimed for deletion' do
......
...@@ -23,7 +23,7 @@ RSpec.describe GroupsWithTemplatesFinder do ...@@ -23,7 +23,7 @@ RSpec.describe GroupsWithTemplatesFinder do
create(:project, namespace: subgroup_2) create(:project, namespace: subgroup_2)
create(:project, namespace: subgroup_3) create(:project, namespace: subgroup_3)
create(:gitlab_subscription, :ultimate, namespace: group_1) create(:gitlab_subscription, :ultimate, namespace: group_1)
create(:gitlab_subscription, :silver, namespace: group_2) create(:gitlab_subscription, :premium, namespace: group_2)
end end
describe 'without group id' do describe 'without group id' do
...@@ -36,7 +36,7 @@ RSpec.describe GroupsWithTemplatesFinder do ...@@ -36,7 +36,7 @@ RSpec.describe GroupsWithTemplatesFinder do
allow(Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?) { true } allow(Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?) { true }
end end
it 'returns groups on ultimate/silver plan' do it 'returns groups on ultimate/premium plan' do
expect(described_class.new.execute).to contain_exactly(group_1, group_2) expect(described_class.new.execute).to contain_exactly(group_1, group_2)
end end
...@@ -46,7 +46,7 @@ RSpec.describe GroupsWithTemplatesFinder do ...@@ -46,7 +46,7 @@ RSpec.describe GroupsWithTemplatesFinder do
create(:project, namespace: subgroup_5) create(:project, namespace: subgroup_5)
end end
it 'returns groups on ultimate/silver plan' do it 'returns groups on ultimate/premium plan' do
expect(described_class.new.execute).to contain_exactly(group_1, group_2, subgroup_4) expect(described_class.new.execute).to contain_exactly(group_1, group_2, subgroup_4)
end end
end end
......
...@@ -94,9 +94,9 @@ ...@@ -94,9 +94,9 @@
"deprecated": true "deprecated": true
}, },
{ {
"id": "silver-external-id", "id": "premium-external-id",
"about_page_href": "https://about.gitlab.com/gitlab-com/", "about_page_href": "https://about.gitlab.com/gitlab-com/",
"code": "silver", "code": "premium",
"features": [ "features": [
{ {
"highlight": false, "highlight": false,
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
} }
], ],
"free": false, "free": false,
"name": "Silver Plan", "name": "Premium Plan",
"price_per_month": 19.0, "price_per_month": 19.0,
"price_per_year": 228.0, "price_per_year": 228.0,
"purchase_link": { "purchase_link": {
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
}, },
{ {
"highlight": true, "highlight": true,
"title": "All Silver features" "title": "All Premium features"
}, },
{ {
"highlight": false, "highlight": false,
......
...@@ -7,7 +7,7 @@ constants.TAX_RATE = 0; ...@@ -7,7 +7,7 @@ constants.TAX_RATE = 0;
describe('projectsSelector default state', () => { describe('projectsSelector default state', () => {
const availablePlans = [ const availablePlans = [
{ id: 'firstPlanId', code: 'bronze', price_per_year: 48, name: 'Bronze Plan' }, { id: 'firstPlanId', code: 'bronze', price_per_year: 48, name: 'Bronze Plan' },
{ id: 'secondPlanId', code: 'silver', price_per_year: 228, name: 'silver Plan' }, { id: 'secondPlanId', code: 'premium', price_per_year: 228, name: 'Premium Plan' },
]; ];
const groupData = [ const groupData = [
...@@ -39,7 +39,7 @@ describe('projectsSelector default state', () => { ...@@ -39,7 +39,7 @@ describe('projectsSelector default state', () => {
it('sets the availablePlans to the provided parsed availablePlans', () => { it('sets the availablePlans to the provided parsed availablePlans', () => {
expect(state.availablePlans).toEqual([ expect(state.availablePlans).toEqual([
{ value: 'firstPlanId', text: 'Bronze Plan', pricePerUserPerYear: 48 }, { value: 'firstPlanId', text: 'Bronze Plan', pricePerUserPerYear: 48 },
{ value: 'secondPlanId', text: 'Silver Plan', pricePerUserPerYear: 228 }, { value: 'secondPlanId', text: 'Premium Plan', pricePerUserPerYear: 228 },
]); ]);
}); });
......
...@@ -162,7 +162,7 @@ RSpec.describe BillingPlansHelper do ...@@ -162,7 +162,7 @@ RSpec.describe BillingPlansHelper do
Plan::BRONZE | false | '123456789' | :upgrade_for_offer Plan::BRONZE | false | '123456789' | :upgrade_for_offer
Plan::BRONZE | false | nil | :no_offer Plan::BRONZE | false | nil | :no_offer
Plan::BRONZE | nil | nil | :no_offer Plan::BRONZE | nil | nil | :no_offer
Plan::SILVER | nil | nil | :no_offer Plan::PREMIUM | nil | nil | :no_offer
nil | true | nil | :no_offer nil | true | nil | :no_offer
end end
...@@ -374,7 +374,7 @@ RSpec.describe BillingPlansHelper do ...@@ -374,7 +374,7 @@ RSpec.describe BillingPlansHelper do
end end
describe '#billing_available_plans' do describe '#billing_available_plans' do
let(:plan) { double('Plan', deprecated?: false, code: 'silver', hide_deprecated_card?: false) } let(:plan) { double('Plan', deprecated?: false, code: 'premium', hide_deprecated_card?: false) }
let(:deprecated_plan) { double('Plan', deprecated?: true, code: 'bronze', hide_deprecated_card?: false) } let(:deprecated_plan) { double('Plan', deprecated?: true, code: 'bronze', hide_deprecated_card?: false) }
let(:plans_data) { [plan, deprecated_plan] } let(:plans_data) { [plan, deprecated_plan] }
...@@ -385,7 +385,7 @@ RSpec.describe BillingPlansHelper do ...@@ -385,7 +385,7 @@ RSpec.describe BillingPlansHelper do
end end
context 'when namespace is on an active plan' do context 'when namespace is on an active plan' do
let(:current_plan) { OpenStruct.new(code: 'silver') } let(:current_plan) { OpenStruct.new(code: 'premium') }
it 'returns plans without deprecated' do it 'returns plans without deprecated' do
expect(helper.billing_available_plans(plans_data, nil)).to eq([plan]) expect(helper.billing_available_plans(plans_data, nil)).to eq([plan])
...@@ -410,8 +410,8 @@ RSpec.describe BillingPlansHelper do ...@@ -410,8 +410,8 @@ RSpec.describe BillingPlansHelper do
end end
context 'when namespace is on a plan that has hide_deprecated_card set to true, but deprecated? is false' do context 'when namespace is on a plan that has hide_deprecated_card set to true, but deprecated? is false' do
let(:current_plan) { OpenStruct.new(code: 'silver') } let(:current_plan) { OpenStruct.new(code: 'premium') }
let(:plan) { double('Plan', deprecated?: false, code: 'silver', hide_deprecated_card?: true) } let(:plan) { double('Plan', deprecated?: false, code: 'premium', hide_deprecated_card?: true) }
it 'returns plans with the deprecated plan' do it 'returns plans with the deprecated plan' do
expect(helper.billing_available_plans(plans_data, current_plan)).to eq([plan]) expect(helper.billing_available_plans(plans_data, current_plan)).to eq([plan])
...@@ -435,10 +435,10 @@ RSpec.describe BillingPlansHelper do ...@@ -435,10 +435,10 @@ RSpec.describe BillingPlansHelper do
end end
it 'breaks a tie with the current_subscription_plan attribute if multiple plans have the same code' do it 'breaks a tie with the current_subscription_plan attribute if multiple plans have the same code' do
other_plan = Hashie::Mash.new(current_subscription_plan: false, code: 'silver') other_plan = Hashie::Mash.new(current_subscription_plan: false, code: 'premium')
current_plan = Hashie::Mash.new(current_subscription_plan: true, code: 'silver') current_plan = Hashie::Mash.new(current_subscription_plan: true, code: 'premium')
expect(helper.subscription_plan_info([other_plan, current_plan], 'silver')).to eq(current_plan) expect(helper.subscription_plan_info([other_plan, current_plan], 'premium')).to eq(current_plan)
end end
it 'returns nil if no plan matches the code even if current_subscription_plan is true' do it 'returns nil if no plan matches the code even if current_subscription_plan is true' do
...@@ -450,9 +450,9 @@ RSpec.describe BillingPlansHelper do ...@@ -450,9 +450,9 @@ RSpec.describe BillingPlansHelper do
it 'returns the plan matching the plan code even if current_subscription_plan is false' do it 'returns the plan matching the plan code even if current_subscription_plan is false' do
other_plan = Hashie::Mash.new(current_subscription_plan: false, code: 'bronze') other_plan = Hashie::Mash.new(current_subscription_plan: false, code: 'bronze')
current_plan = Hashie::Mash.new(current_subscription_plan: false, code: 'silver') current_plan = Hashie::Mash.new(current_subscription_plan: false, code: 'premium')
expect(helper.subscription_plan_info([other_plan, current_plan], 'silver')).to eq(current_plan) expect(helper.subscription_plan_info([other_plan, current_plan], 'premium')).to eq(current_plan)
end end
end end
end end
...@@ -28,14 +28,14 @@ RSpec.describe Gitlab::ApplicationContext do ...@@ -28,14 +28,14 @@ RSpec.describe Gitlab::ApplicationContext do
end end
it 'falls back to a projects namespace plan when a project is passed but no namespace' do it 'falls back to a projects namespace plan when a project is passed but no namespace' do
create(:gitlab_subscription, :silver, namespace: project.namespace) create(:gitlab_subscription, :premium, namespace: project.namespace)
project.actual_plan_name project.actual_plan_name
context = described_class.new(project: project) context = described_class.new(project: project)
expect(result(context)) expect(result(context))
.to include(project: project.full_path, .to include(project: project.full_path,
root_namespace: project.full_path_components.first, root_namespace: project.full_path_components.first,
subscription_plan: 'silver') subscription_plan: 'premium')
end end
end end
......
...@@ -196,10 +196,14 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do ...@@ -196,10 +196,14 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
end end
end end
it 'has silver plan specific messaging' do where plan: %w(silver premium)
allow(subscribable).to receive(:plan).and_return('silver')
expect(subject).to include('Your Silver subscription for No Limit Records will expire on 2020-03-09. After that, you will not be able to use merge approvals or epics as well as many other features.') with_them do
it 'has plan specific messaging' do
allow(subscribable).to receive(:plan).and_return('premium')
expect(subject).to include('Your Premium subscription for No Limit Records will expire on 2020-03-09. After that, you will not be able to use merge approvals or epics as well as many other features.')
end
end end
it 'has bronze plan specific messaging' do it 'has bronze plan specific messaging' do
......
...@@ -11,7 +11,7 @@ RSpec.describe Namespace do ...@@ -11,7 +11,7 @@ RSpec.describe Namespace do
let(:default_plan) { create(:default_plan) } let(:default_plan) { create(:default_plan) }
let(:free_plan) { create(:free_plan) } let(:free_plan) { create(:free_plan) }
let!(:bronze_plan) { create(:bronze_plan) } let!(:bronze_plan) { create(:bronze_plan) }
let!(:silver_plan) { create(:silver_plan) } let!(:premium_plan) { create(:premium_plan) }
let!(:ultimate_plan) { create(:ultimate_plan) } let!(:ultimate_plan) { create(:ultimate_plan) }
it { is_expected.to have_one(:namespace_statistics) } it { is_expected.to have_one(:namespace_statistics) }
...@@ -971,7 +971,7 @@ RSpec.describe Namespace do ...@@ -971,7 +971,7 @@ RSpec.describe Namespace do
end end
context 'with other plans' do context 'with other plans' do
%i[bronze_plan silver_plan].each do |plan| %i[bronze_plan premium_plan].each do |plan|
it 'includes active guest users' do it 'includes active guest users' do
create(:gitlab_subscription, namespace: group, hosted_plan: send(plan)) create(:gitlab_subscription, namespace: group, hosted_plan: send(plan))
expect(group.billed_user_ids).to match_array([guest.id, developer.id]) expect(group.billed_user_ids).to match_array([guest.id, developer.id])
...@@ -1133,7 +1133,7 @@ RSpec.describe Namespace do ...@@ -1133,7 +1133,7 @@ RSpec.describe Namespace do
end end
context 'with other plans' do context 'with other plans' do
%i[bronze_plan silver_plan].each do |plan| %i[bronze_plan premium_plan].each do |plan|
it 'counts active guest users' do it 'counts active guest users' do
create(:gitlab_subscription, namespace: group, hosted_plan: send(plan)) create(:gitlab_subscription, namespace: group, hosted_plan: send(plan))
expect(group.billable_members_count).to eq(2) expect(group.billable_members_count).to eq(2)
......
...@@ -513,7 +513,7 @@ RSpec.describe User do ...@@ -513,7 +513,7 @@ RSpec.describe User do
allow(Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?) { true } allow(Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?) { true }
end end
it 'returns groups on ultimate or silver plans' do it 'returns groups on ultimate or premium plans' do
groups = user.available_subgroups_with_custom_project_templates groups = user.available_subgroups_with_custom_project_templates
expect(groups.size).to eq(1) expect(groups.size).to eq(1)
...@@ -922,7 +922,7 @@ RSpec.describe User do ...@@ -922,7 +922,7 @@ RSpec.describe User do
context 'when namespace is on a plan that is not free or ultimate' do context 'when namespace is on a plan that is not free or ultimate' do
before do before do
create(:gitlab_subscription, namespace: namespace, hosted_plan: create(:silver_plan)) create(:gitlab_subscription, namespace: namespace, hosted_plan: create(:premium_plan))
end end
context 'user is a guest' do context 'user is a guest' do
...@@ -1502,7 +1502,7 @@ RSpec.describe User do ...@@ -1502,7 +1502,7 @@ RSpec.describe User do
where(:hosted_plan, :result) do where(:hosted_plan, :result) do
:bronze_plan | true :bronze_plan | true
:silver_plan | true :premium_plan | true
:ultimate_plan | false :ultimate_plan | false
:free_plan | false :free_plan | false
:default_plan | false :default_plan | false
...@@ -1529,7 +1529,7 @@ RSpec.describe User do ...@@ -1529,7 +1529,7 @@ RSpec.describe User do
it 'returns false when the user has multiple groups and any group has ultimate' do it 'returns false when the user has multiple groups and any group has ultimate' do
create(:group_with_plan, plan: :bronze_plan).add_owner(user) create(:group_with_plan, plan: :bronze_plan).add_owner(user)
create(:group_with_plan, plan: :silver_plan).add_owner(user) create(:group_with_plan, plan: :premium_plan).add_owner(user)
create(:group_with_plan, plan: :ultimate_plan).add_owner(user) create(:group_with_plan, plan: :ultimate_plan).add_owner(user)
user.namespace.plans.reload user.namespace.plans.reload
......
...@@ -43,7 +43,7 @@ RSpec.describe ElasticsearchIndexedNamespace do ...@@ -43,7 +43,7 @@ RSpec.describe ElasticsearchIndexedNamespace do
let_it_be(:namespaces) { create_list(:namespace, 3) } let_it_be(:namespaces) { create_list(:namespace, 3) }
let_it_be(:subscription1) { create(:gitlab_subscription, namespace: namespaces[2]) } let_it_be(:subscription1) { create(:gitlab_subscription, namespace: namespaces[2]) }
let_it_be(:subscription2) { create(:gitlab_subscription, namespace: namespaces[0]) } let_it_be(:subscription2) { create(:gitlab_subscription, namespace: namespaces[0]) }
let_it_be(:subscription3) { create(:gitlab_subscription, :silver, namespace: namespaces[1]) } let_it_be(:subscription3) { create(:gitlab_subscription, :premium, namespace: namespaces[1]) }
before do before do
stub_ee_application_setting(elasticsearch_indexing: false) stub_ee_application_setting(elasticsearch_indexing: false)
...@@ -75,7 +75,7 @@ RSpec.describe ElasticsearchIndexedNamespace do ...@@ -75,7 +75,7 @@ RSpec.describe ElasticsearchIndexedNamespace do
expect(get_indexed_namespaces).to eq([ids[0], ids[2]]) expect(get_indexed_namespaces).to eq([ids[0], ids[2]])
expect_queue_to_contain(ids[2], "index") expect_queue_to_contain(ids[2], "index")
described_class.index_first_n_namespaces_of_plan('silver', 1) described_class.index_first_n_namespaces_of_plan('premium', 1)
expect(get_indexed_namespaces).to eq([ids[0], ids[2], ids[1]]) expect(get_indexed_namespaces).to eq([ids[0], ids[2], ids[1]])
expect_queue_to_contain(ids[1], "index") expect_queue_to_contain(ids[1], "index")
...@@ -85,7 +85,7 @@ RSpec.describe ElasticsearchIndexedNamespace do ...@@ -85,7 +85,7 @@ RSpec.describe ElasticsearchIndexedNamespace do
describe '.unindex_last_n_namespaces_of_plan' do describe '.unindex_last_n_namespaces_of_plan' do
before do before do
described_class.index_first_n_namespaces_of_plan('ultimate', 2) described_class.index_first_n_namespaces_of_plan('ultimate', 2)
described_class.index_first_n_namespaces_of_plan('silver', 1) described_class.index_first_n_namespaces_of_plan('premium', 1)
end end
it 'creates records, scoped by plan and ordered by namespace id' do it 'creates records, scoped by plan and ordered by namespace id' do
...@@ -100,7 +100,7 @@ RSpec.describe ElasticsearchIndexedNamespace do ...@@ -100,7 +100,7 @@ RSpec.describe ElasticsearchIndexedNamespace do
expect(get_indexed_namespaces).to contain_exactly(ids[0], ids[1]) expect(get_indexed_namespaces).to contain_exactly(ids[0], ids[1])
expect_queue_to_contain(ids[2], "delete") expect_queue_to_contain(ids[2], "delete")
described_class.unindex_last_n_namespaces_of_plan('silver', 1) described_class.unindex_last_n_namespaces_of_plan('premium', 1)
expect(get_indexed_namespaces).to contain_exactly(ids[0]) expect(get_indexed_namespaces).to contain_exactly(ids[0])
expect_queue_to_contain(ids[1], "delete") expect_queue_to_contain(ids[1], "delete")
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSubscription do RSpec.describe GitlabSubscription do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
%i[free_plan bronze_plan silver_plan ultimate_plan].each do |plan| %i[free_plan bronze_plan premium_plan ultimate_plan].each do |plan|
let_it_be(plan) { create(plan) } let_it_be(plan) { create(plan) }
end end
...@@ -35,13 +35,13 @@ RSpec.describe GitlabSubscription do ...@@ -35,13 +35,13 @@ RSpec.describe GitlabSubscription do
describe 'scopes' do describe 'scopes' do
describe '.with_hosted_plan' do describe '.with_hosted_plan' do
let!(:ultimate_subscription) { create(:gitlab_subscription, hosted_plan: ultimate_plan) } let!(:ultimate_subscription) { create(:gitlab_subscription, hosted_plan: ultimate_plan) }
let!(:silver_subscription) { create(:gitlab_subscription, hosted_plan: silver_plan) } let!(:premium_subscription) { create(:gitlab_subscription, hosted_plan: premium_plan) }
let!(:trial_subscription) { create(:gitlab_subscription, hosted_plan: ultimate_plan, trial: true) } let!(:trial_subscription) { create(:gitlab_subscription, hosted_plan: ultimate_plan, trial: true) }
it 'scopes to the plan' do it 'scopes to the plan' do
expect(described_class.with_hosted_plan('ultimate')).to contain_exactly(ultimate_subscription) expect(described_class.with_hosted_plan('ultimate')).to contain_exactly(ultimate_subscription)
expect(described_class.with_hosted_plan('silver')).to contain_exactly(silver_subscription) expect(described_class.with_hosted_plan('premium')).to contain_exactly(premium_subscription)
expect(described_class.with_hosted_plan('bronze')).to be_empty expect(described_class.with_hosted_plan('bronze')).to be_empty
end end
end end
...@@ -102,7 +102,7 @@ RSpec.describe GitlabSubscription do ...@@ -102,7 +102,7 @@ RSpec.describe GitlabSubscription do
end end
context 'with other plans' do context 'with other plans' do
%w[bronze silver].each do |plan| %w[bronze premium].each do |plan|
it 'excludes these members' do it 'excludes these members' do
gitlab_subscription.update!(plan_code: plan) gitlab_subscription.update!(plan_code: plan)
...@@ -121,7 +121,7 @@ RSpec.describe GitlabSubscription do ...@@ -121,7 +121,7 @@ RSpec.describe GitlabSubscription do
end end
it 'always returns 1 seat' do it 'always returns 1 seat' do
[bronze_plan, silver_plan, ultimate_plan].each do |plan| [bronze_plan, premium_plan, ultimate_plan].each do |plan|
gitlab_subscription.update!(hosted_plan: plan) gitlab_subscription.update!(hosted_plan: plan)
expect(gitlab_subscription.calculate_seats_in_use).to eq(1) expect(gitlab_subscription.calculate_seats_in_use).to eq(1)
...@@ -302,7 +302,7 @@ RSpec.describe GitlabSubscription do ...@@ -302,7 +302,7 @@ RSpec.describe GitlabSubscription do
'bronze' | 0 | true | false 'bronze' | 0 | true | false
'bronze' | 1 | true | true 'bronze' | 1 | true | true
'bronze' | 1 | false | false 'bronze' | 1 | false | false
'silver' | 1 | true | true 'premium' | 1 | true | true
end end
with_them do with_them do
...@@ -326,7 +326,7 @@ RSpec.describe GitlabSubscription do ...@@ -326,7 +326,7 @@ RSpec.describe GitlabSubscription do
where(:plan_name, :paid_hosted_plan, :expired, :result) do where(:plan_name, :paid_hosted_plan, :expired, :result) do
'bronze' | true | false | true 'bronze' | true | false | true
'bronze' | true | true | false 'bronze' | true | true | false
'silver' | true | false | true 'premium' | true | false | true
'ultimate' | true | false | false 'ultimate' | true | false | false
end end
......
...@@ -1496,8 +1496,8 @@ RSpec.describe Project do ...@@ -1496,8 +1496,8 @@ RSpec.describe Project do
allow(License).to receive(:current).and_return(global_license) allow(License).to receive(:current).and_return(global_license)
allow(global_license).to receive(:features).and_return([ allow(global_license).to receive(:features).and_return([
:subepics, # Ultimate only :subepics, # Ultimate only
:epics, # Silver and up :epics, # Premium and up
:push_rules, # Silver and up :push_rules, # Premium and up
:audit_events, # Bronze and up :audit_events, # Bronze and up
:geo # Global feature, should not be checked at namespace level :geo # Global feature, should not be checked at namespace level
]) ])
...@@ -1518,10 +1518,10 @@ RSpec.describe Project do ...@@ -1518,10 +1518,10 @@ RSpec.describe Project do
end end
end end
context 'when silver' do context 'when premium' do
let(:plan_license) { :silver } let(:plan_license) { :premium }
it 'filters for silver features' do it 'filters for premium features' do
is_expected.to contain_exactly(:push_rules, :audit_events, :geo, :epics) is_expected.to contain_exactly(:push_rules, :audit_events, :geo, :epics)
end end
end end
......
...@@ -298,8 +298,8 @@ RSpec.describe PushRule do ...@@ -298,8 +298,8 @@ RSpec.describe PushRule do
it_behaves_like 'an unavailable push_rule' it_behaves_like 'an unavailable push_rule'
end end
context 'with a Silver plan' do context 'with a Premium plan' do
let(:plan) { :silver } let(:plan) { :premium }
it_behaves_like 'an available push_rule' it_behaves_like 'an available push_rule'
end end
......
...@@ -409,7 +409,7 @@ RSpec.describe GroupPolicy do ...@@ -409,7 +409,7 @@ RSpec.describe GroupPolicy do
before_all do before_all do
create(:license, plan: License::ULTIMATE_PLAN) create(:license, plan: License::ULTIMATE_PLAN)
create(:gitlab_subscription, :silver, namespace: group) create(:gitlab_subscription, :premium, namespace: group)
end end
context 'without an enabled SAML provider' do context 'without an enabled SAML provider' do
...@@ -1284,7 +1284,7 @@ RSpec.describe GroupPolicy do ...@@ -1284,7 +1284,7 @@ RSpec.describe GroupPolicy do
end end
it_behaves_like 'model with wiki policies' do it_behaves_like 'model with wiki policies' do
let_it_be_with_refind(:container) { create(:group_with_plan, plan: :silver_plan) } let_it_be_with_refind(:container) { create(:group_with_plan, plan: :premium_plan) }
let_it_be(:user) { owner } let_it_be(:user) { owner }
before_all do before_all do
......
...@@ -99,9 +99,9 @@ RSpec.describe API::Namespaces do ...@@ -99,9 +99,9 @@ RSpec.describe API::Namespaces do
end end
end end
context 'when requesting silver plan' do context 'when requesting premium plan' do
it 'counts guest members' do it 'counts guest members' do
get api("/namespaces?requested_hosted_plan=silver", user) get api("/namespaces?requested_hosted_plan=premium", user)
expect(json_response.first['billable_members_count']).to eq(3) expect(json_response.first['billable_members_count']).to eq(3)
end end
...@@ -392,11 +392,11 @@ RSpec.describe API::Namespaces do ...@@ -392,11 +392,11 @@ RSpec.describe API::Namespaces do
get api("/namespaces/#{namespace.id}/gitlab_subscription", current_user) get api("/namespaces/#{namespace.id}/gitlab_subscription", current_user)
end end
let_it_be(:silver_plan) { create(:silver_plan) } let_it_be(:premium_plan) { create(:premium_plan) }
let_it_be(:owner) { create(:user) } let_it_be(:owner) { create(:user) }
let_it_be(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
let_it_be(:namespace) { create(:group) } let_it_be(:namespace) { create(:group) }
let_it_be(:gitlab_subscription) { create(:gitlab_subscription, hosted_plan: silver_plan, namespace: namespace) } let_it_be(:gitlab_subscription) { create(:gitlab_subscription, hosted_plan: premium_plan, namespace: namespace) }
before do before do
namespace.add_owner(owner) namespace.add_owner(owner)
...@@ -429,8 +429,8 @@ RSpec.describe API::Namespaces do ...@@ -429,8 +429,8 @@ RSpec.describe API::Namespaces do
expect(json_response.keys).to match_array(%w[plan usage billing]) expect(json_response.keys).to match_array(%w[plan usage billing])
expect(json_response['plan'].keys).to match_array(%w[name code trial upgradable auto_renew]) expect(json_response['plan'].keys).to match_array(%w[name code trial upgradable auto_renew])
expect(json_response['plan']['name']).to eq('Silver') expect(json_response['plan']['name']).to eq('Premium')
expect(json_response['plan']['code']).to eq('silver') expect(json_response['plan']['code']).to eq('premium')
expect(json_response['plan']['trial']).to eq(false) expect(json_response['plan']['trial']).to eq(false)
expect(json_response['plan']['upgradable']).to eq(true) expect(json_response['plan']['upgradable']).to eq(true)
expect(json_response['usage'].keys).to match_array(%w[seats_in_subscription seats_in_use max_seats_used seats_owed]) expect(json_response['usage'].keys).to match_array(%w[seats_in_subscription seats_in_use max_seats_used seats_owed])
...@@ -444,14 +444,14 @@ RSpec.describe API::Namespaces do ...@@ -444,14 +444,14 @@ RSpec.describe API::Namespaces do
put api("/namespaces/#{namespace_id}/gitlab_subscription", current_user), params: payload put api("/namespaces/#{namespace_id}/gitlab_subscription", current_user), params: payload
end end
let_it_be(:silver_plan) { create(:silver_plan) } let_it_be(:premium_plan) { create(:premium_plan) }
let_it_be(:namespace) { create(:group, name: 'test.test-group.22') } let_it_be(:namespace) { create(:group, name: 'test.test-group.22') }
let_it_be(:gitlab_subscription) { create(:gitlab_subscription, namespace: namespace) } let_it_be(:gitlab_subscription) { create(:gitlab_subscription, namespace: namespace) }
let(:params) do let(:params) do
{ {
seats: 150, seats: 150,
plan_code: 'silver', plan_code: 'premium',
start_date: '01/01/2018', start_date: '01/01/2018',
end_date: '01/01/2019' end_date: '01/01/2019'
} }
...@@ -499,8 +499,8 @@ RSpec.describe API::Namespaces do ...@@ -499,8 +499,8 @@ RSpec.describe API::Namespaces do
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(gitlab_subscription.reload.seats).to eq(150) expect(gitlab_subscription.reload.seats).to eq(150)
expect(gitlab_subscription.max_seats_used).to eq(0) expect(gitlab_subscription.max_seats_used).to eq(0)
expect(gitlab_subscription.plan_name).to eq('silver') expect(gitlab_subscription.plan_name).to eq('premium')
expect(gitlab_subscription.plan_title).to eq('Silver') expect(gitlab_subscription.plan_title).to eq('Premium')
end end
it 'is successful using full_path when namespace path contains dots' do it 'is successful using full_path when namespace path contains dots' do
......
...@@ -94,11 +94,11 @@ RSpec.describe Dashboard::Projects::ListService do ...@@ -94,11 +94,11 @@ RSpec.describe Dashboard::Projects::ListService do
where(:check_namespace_plan, :plan, :available) do where(:check_namespace_plan, :plan, :available) do
true | :gold | true true | :gold | true
true | :silver | true true | :premium | true
true | :ultimate | true true | :ultimate | true
true | nil | false true | nil | false
false | :gold | true false | :gold | true
false | :silver | true false | :premium | true
false | :ultimate | true false | :ultimate | true
false | nil | true false | nil | true
end end
......
...@@ -41,7 +41,7 @@ RSpec.shared_examples 'dashboard ultimate trial callout' do ...@@ -41,7 +41,7 @@ RSpec.shared_examples 'dashboard ultimate trial callout' do
it 'hides promotion callout if a trial is active' do it 'hides promotion callout if a trial is active' do
allow_any_instance_of(EE::DashboardHelper).to receive(:user_default_dashboard?).and_return(true) allow_any_instance_of(EE::DashboardHelper).to receive(:user_default_dashboard?).and_return(true)
group = create(:group_with_plan, name: 'trial group', plan: :silver_plan, trial_ends_on: 1.year.from_now) group = create(:group_with_plan, name: 'trial group', plan: :premium_plan, trial_ends_on: 1.year.from_now)
group.add_owner(user) group.add_owner(user)
visit page_path visit page_path
...@@ -81,9 +81,9 @@ RSpec.shared_examples 'billings ultimate trial callout' do ...@@ -81,9 +81,9 @@ RSpec.shared_examples 'billings ultimate trial callout' do
end end
context "on a plan that isn't ultimate", :js do context "on a plan that isn't ultimate", :js do
let(:plans) { { bronze: create(:bronze_plan), silver: create(:silver_plan) } } let(:plans) { { bronze: create(:bronze_plan), premium: create(:premium_plan) } }
where(case_names: ->(plan_type) {"like #{plan_type}"}, plan_type: [:bronze, :silver]) where(case_names: ->(plan_type) {"like #{plan_type}"}, plan_type: [:bronze, :premium])
with_them do with_them do
let(:plan) { plans[plan_type] } let(:plan) { plans[plan_type] }
......
...@@ -53,7 +53,7 @@ RSpec.describe 'shared/billings/_eoa_bronze_plan_banner.html.haml' do ...@@ -53,7 +53,7 @@ RSpec.describe 'shared/billings/_eoa_bronze_plan_banner.html.haml' do
shared_examples 'with a different plan than Bronze' do shared_examples 'with a different plan than Bronze' do
before do before do
allow(namespace).to receive(:actual_plan_name).and_return(::Plan::SILVER) allow(namespace).to receive(:actual_plan_name).and_return(::Plan::PREMIUM)
end end
it 'does not display the banner' do it 'does not display the banner' do
......
...@@ -26,7 +26,7 @@ RSpec.describe 'shared/billings/_trial_status.html.haml' do ...@@ -26,7 +26,7 @@ RSpec.describe 'shared/billings/_trial_status.html.haml' do
let(:trial) { true } let(:trial) { true }
context 'with a ultimate trial' do context 'with a ultimate trial' do
let(:plan) { create(:ultimate_plan, title: 'Ultimate') } let(:plan) { create(:ultimate_plan) }
it 'displays expiry date and Ultimate' do it 'displays expiry date and Ultimate' do
render 'shared/billings/trial_status', namespace: group render 'shared/billings/trial_status', namespace: group
...@@ -35,13 +35,13 @@ RSpec.describe 'shared/billings/_trial_status.html.haml' do ...@@ -35,13 +35,13 @@ RSpec.describe 'shared/billings/_trial_status.html.haml' do
end end
end end
context 'with a silver trial' do context 'with a premium trial' do
let(:plan) { create(:gold_plan, title: 'Silver') } let(:plan) { create(:premium_plan) }
it 'displays expiry date and Silver' do it 'displays expiry date and Premium' do
render 'shared/billings/trial_status', namespace: group render 'shared/billings/trial_status', namespace: group
expect(rendered).to have_content("Your GitLab.com Silver trial will expire after #{trial_ends_on}. You can retain access to the Silver features by upgrading below.") expect(rendered).to have_content("Your GitLab.com Premium trial will expire after #{trial_ends_on}. You can retain access to the Premium features by upgrading below.")
end end
end end
end end
......
...@@ -56,18 +56,18 @@ RSpec.describe ElasticNamespaceRolloutWorker do ...@@ -56,18 +56,18 @@ RSpec.describe ElasticNamespaceRolloutWorker do
it 'distinguishes different plans' do it 'distinguishes different plans' do
# Rollout # Rollout
subject.perform('ultimate', 50, ROLLOUT) subject.perform('ultimate', 50, ROLLOUT)
subject.perform('silver', 25, ROLLOUT) subject.perform('premium', 25, ROLLOUT)
expect( expect(
ElasticsearchIndexedNamespace.pluck(:namespace_id) ElasticsearchIndexedNamespace.pluck(:namespace_id)
).to contain_exactly( ).to contain_exactly(
*get_namespace_ids(:ultimate, 2), *get_namespace_ids(:ultimate, 2),
*get_namespace_ids(:silver, 1) *get_namespace_ids(:premium, 1)
) )
# Rollback # Rollback
subject.perform('ultimate', 25, ROLLBACK) subject.perform('ultimate', 25, ROLLBACK)
subject.perform('silver', 0, ROLLBACK) subject.perform('premium', 0, ROLLBACK)
expect( expect(
ElasticsearchIndexedNamespace.pluck(:namespace_id) ElasticsearchIndexedNamespace.pluck(:namespace_id)
......
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