fix spec rubcop

This commit is contained in:
Tanmay Sharma
2025-10-12 17:26:07 +05:30
parent cef23891af
commit 2c095bed86
2 changed files with 9 additions and 14 deletions
@@ -133,12 +133,4 @@ class Enterprise::Api::V1::AccountsController < Api::BaseController
account_user: @current_account_user
}
end
def v2_enabled?
Rails.application.config.stripe_v2[:enabled] && @account.custom_attributes['stripe_billing_version'].to_i == 2
end
def render_v2_not_enabled
render json: { error: 'V2 billing not enabled for this account' }, status: :unprocessable_entity
end
end
@@ -91,12 +91,15 @@ RSpec.describe Enterprise::Billing::V2::PricingPlanService do
rate_card = OpenStruct.new(id: 'rc_123', latest_version: 'v1')
allow(StripeV2Client).to receive(:request).and_return(cpu, meter, plan, service_action, rate_card)
allow_any_instance_of(Enterprise::Billing::V2::PricingPlanComponentBuilder)
.to receive(:add_license_fee_component).and_return(true)
allow_any_instance_of(Enterprise::Billing::V2::PricingPlanComponentBuilder)
.to receive(:add_service_action_component).and_return(service_action)
allow_any_instance_of(Enterprise::Billing::V2::PricingPlanComponentBuilder)
.to receive(:add_rate_card_component).and_return(rate_card)
# Create a double for the component builder
component_builder = instance_double(Enterprise::Billing::V2::PricingPlanComponentBuilder)
allow(component_builder).to receive(:add_license_fee_component).and_return(true)
allow(component_builder).to receive(:add_service_action_component).and_return(service_action)
allow(component_builder).to receive(:add_rate_card_component).and_return(rate_card)
# Stub the private component_builder method to return our double
allow(service).to receive(:component_builder).and_return(component_builder)
result = service.create_complete_pricing_plan(config)