Billing Stripe, link regia mobile e staff solo trasmissione.
Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
38
backend/spec/helpers/public/billing_helper_spec.rb
Normal file
38
backend/spec/helpers/public/billing_helper_spec.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Public::BillingHelper, type: :helper do
|
||||
before { load Rails.root.join("db/seeds/plans.rb") }
|
||||
|
||||
let(:premium_light) { Plan["premium_light"] }
|
||||
let(:premium_full) { Plan["premium_full"] }
|
||||
let(:free_plan) { Plan["free"] }
|
||||
|
||||
it "segna il piano corrente" do
|
||||
action = helper.plan_billing_action(
|
||||
current_slug: "premium_light",
|
||||
target_plan: premium_light,
|
||||
stripe_subscription_active: true
|
||||
)
|
||||
expect(action[:kind]).to eq(:current)
|
||||
end
|
||||
|
||||
it "propone attivazione da free" do
|
||||
action = helper.plan_billing_action(
|
||||
current_slug: "free",
|
||||
target_plan: premium_light,
|
||||
stripe_subscription_active: false
|
||||
)
|
||||
expect(action[:kind]).to eq(:checkout)
|
||||
expect(action[:label]).to include("Attiva")
|
||||
end
|
||||
|
||||
it "propone upgrade con abbonamento attivo" do
|
||||
action = helper.plan_billing_action(
|
||||
current_slug: "premium_light",
|
||||
target_plan: premium_full,
|
||||
stripe_subscription_active: true
|
||||
)
|
||||
expect(action[:kind]).to eq(:change)
|
||||
expect(action[:label]).to include("Passa a")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user