Commit 29afe4ac authored by mehulsharma's avatar mehulsharma Committed by Peter Leitzen

Fix OpenStruct use

Fixes OpenStruct use in billing_plans_helper_spec

Changelog: other
EE: true
parent cccf2b50
......@@ -2567,7 +2567,6 @@ Style/OpenStructUse:
- 'ee/spec/graphql/ee/resolvers/board_lists_resolver_spec.rb'
- 'ee/spec/graphql/mutations/merge_requests/accept_spec.rb'
- 'ee/spec/graphql/resolvers/board_groupings/epics_resolvers_spec.rb'
- 'ee/spec/helpers/billing_plans_helper_spec.rb'
- 'ee/spec/helpers/ee/blob_helper_spec.rb'
- 'ee/spec/lib/gitlab/auth/group_saml/failure_handler_spec.rb'
- 'ee/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb'
......
......@@ -14,7 +14,7 @@ RSpec.describe BillingPlansHelper, :saas do
let(:refresh_seats_href) { helper.refresh_seats_group_billings_url(group) }
let(:plan) do
OpenStruct.new(id: 'external-paid-plan-hash-code', name: 'Bronze Plan')
double('plan', id: 'external-paid-plan-hash-code', name: 'Bronze Plan')
end
context 'when group and plan with ID present' do
......@@ -92,7 +92,7 @@ RSpec.describe BillingPlansHelper, :saas do
end
context 'when plan with ID not present' do
let(:plan) { OpenStruct.new(id: nil, name: 'Bronze Plan') }
let(:plan) { double('plan', id: nil, name: 'Bronze Plan') }
let(:base_attrs) do
{
......@@ -217,7 +217,7 @@ RSpec.describe BillingPlansHelper, :saas do
describe '#upgrade_offer_type' do
using RSpec::Parameterized::TableSyntax
let(:plan) { OpenStruct.new({ id: '123456789' }) }
let(:plan) { double('plan', { id: '123456789' }) }
context 'when plan has a valid property' do
where(:plan_name, :for_free, :plan_id, :result) do
......@@ -233,7 +233,7 @@ RSpec.describe BillingPlansHelper, :saas do
with_them do
let(:namespace) do
OpenStruct.new(
double('plan',
{
actual_plan_name: plan_name,
id: '000000000'
......@@ -462,7 +462,7 @@ RSpec.describe BillingPlansHelper, :saas do
end
context 'when namespace is on an active plan' do
let(:current_plan) { OpenStruct.new(code: 'premium') }
let(:current_plan) { double('plan', code: 'premium') }
it 'returns plans without deprecated' do
expect(helper.billing_available_plans(plans_data, nil)).to eq([plan])
......@@ -470,7 +470,7 @@ RSpec.describe BillingPlansHelper, :saas do
end
context 'when namespace is on a deprecated plan' do
let(:current_plan) { OpenStruct.new(code: 'bronze') }
let(:current_plan) { double('plan', code: 'bronze') }
it 'returns plans with a deprecated plan' do
expect(helper.billing_available_plans(plans_data, current_plan)).to eq(plans_data)
......@@ -478,7 +478,7 @@ RSpec.describe BillingPlansHelper, :saas do
end
context 'when namespace is on a deprecated plan that has hide_deprecated_card set to true' do
let(:current_plan) { OpenStruct.new(code: 'bronze') }
let(:current_plan) { double('plan', code: 'bronze') }
let(:deprecated_plan) { double('Plan', deprecated?: true, code: 'bronze', hide_deprecated_card?: true) }
it 'returns plans without the deprecated plan' do
......@@ -487,7 +487,7 @@ RSpec.describe BillingPlansHelper, :saas do
end
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: 'premium') }
let(:current_plan) { double('plan', code: 'premium') }
let(:plan) { double('Plan', deprecated?: false, code: 'premium', hide_deprecated_card?: true) }
it 'returns plans with the deprecated plan' 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