Files
MatchLiveTv/backend/spec/services/billing/stripe/plan_change_kind_spec.rb
Emiliano Frascaro 566104aff4 Billing upgrade/downgrade, inviti in app e diretta YouTube da mobile.
Upgrade Stripe con addebito immediato; downgrade programmato a fine periodo.
UX billing più sobria con box info; icone piani. API inviti e OAuth YouTube
per staff trasmissione; deep link join; scelta partita programmata o nuova.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 22:15:27 +02:00

33 lines
917 B
Ruby

require "rails_helper"
RSpec.describe Billing::Stripe::PlanChangeKind do
before { load Rails.root.join("db/seeds/plans.rb") }
it "classifica light → full come upgrade" do
expect(described_class.classify(
from_plan_slug: "premium_light",
from_interval: "monthly",
to_plan_slug: "premium_full",
to_interval: "monthly"
)).to eq(:upgrade)
end
it "classifica full → light come downgrade" do
expect(described_class.classify(
from_plan_slug: "premium_full",
from_interval: "monthly",
to_plan_slug: "premium_light",
to_interval: "monthly"
)).to eq(:downgrade)
end
it "classifica passaggio a annuale come upgrade sullo stesso piano" do
expect(described_class.classify(
from_plan_slug: "premium_light",
from_interval: "monthly",
to_plan_slug: "premium_light",
to_interval: "yearly"
)).to eq(:upgrade)
end
end