Files
MatchLiveTv/backend/spec/services/teams/entitlements_cover_spec.rb
T
eminuxandCursor 41d4235258 Aggiunge copertina sponsor custom solo Premium Full, con override in wizard e slate sui nodi di streaming.
Permette upload da portale e app con ereditarietà partita→squadra→società, generazione MP4 via ffmpeg e distribuzione su home lab e nodi CPX per pause e assenza segnale.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 23:47:17 +02:00

31 lines
1.1 KiB
Ruby

require "rails_helper"
RSpec.describe Teams::Entitlements do
let!(:club) { Club.create!(name: "Club", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
let!(:team) { club.teams.create!(name: "Team", sport: "volleyball") }
before do
load Rails.root.join("db/seeds/plans.rb")
Billing::AssignPlan.call(club: club, plan_slug: "free")
end
it "non consente copertina custom su free" do
ent = described_class.new(team)
expect(ent.can_use_custom_cover?).to eq(false)
expect { ent.assert_can_upload_cover! }.to raise_error(Teams::EntitlementError, /Premium Full/)
end
it "consente copertina custom su premium full" do
Billing::AssignPlan.call(club: club, plan_slug: "premium_full")
ent = described_class.new(team)
expect(ent.can_use_custom_cover?).to eq(true)
expect { ent.assert_can_upload_cover! }.not_to raise_error
end
it "espone custom_cover_enabled in as_json" do
Billing::AssignPlan.call(club: club, plan_slug: "premium_full")
ent = described_class.new(team)
expect(ent.as_json[:custom_cover_enabled]).to eq(true)
end
end