Il piano si attiva solo dopo la conferma admin; Stripe resta a listino se non c'è un prezzo commerciale. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
722 B
Ruby
28 lines
722 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe ExpireEndedSubscriptionsJob do
|
|
let(:club) do
|
|
c = Club.create!(name: "Expire BT", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff")
|
|
load Rails.root.join("db/seeds/plans.rb")
|
|
c
|
|
end
|
|
|
|
it "passa a Free un piano pagato con bonifico scaduto" do
|
|
Billing::AssignPlan.call(
|
|
club: club,
|
|
plan_slug: "premium_light",
|
|
status: "active",
|
|
stripe_attrs: {
|
|
billing_interval: "monthly",
|
|
current_period_start: 2.months.ago,
|
|
current_period_end: 1.day.ago,
|
|
cancel_at_period_end: true
|
|
}
|
|
)
|
|
|
|
described_class.new.perform
|
|
|
|
expect(club.reload.subscription.plan.slug).to eq("free")
|
|
end
|
|
end
|