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>
39 lines
1.1 KiB
Ruby
39 lines
1.1 KiB
Ruby
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
|