Files
MatchLiveTv/backend/spec/services/streams/cover_slate_ensurer_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

39 lines
1.2 KiB
Ruby

require "rails_helper"
RSpec.describe Streams::CoverSlateEnsurer do
let!(:club) { Club.create!(name: "Club", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
let!(:team) { club.teams.create!(name: "Team", sport: "volleyball") }
let!(:match) { team.matches.create!(opponent_name: "Opp", sport: "volleyball") }
before do
load Rails.root.join("db/seeds/plans.rb")
Billing::AssignPlan.call(club: club, plan_slug: "premium_full")
match.cover_image.attach(
io: StringIO.new("img"),
filename: "c.png",
content_type: "image/png"
)
end
it "genera in sync se manca cover_slate" do
expect(Streams::GenerateCoverSlate).to receive(:call).with(match).and_return(match)
described_class.ensure_for!(match)
end
it "non rigenera se slate pronta su disco" do
match.cover_slate.attach(
io: StringIO.new("mp4"),
filename: "s.mp4",
content_type: "video/mp4"
)
path = Streams::CoverSlatePaths.expected_path(match)
FileUtils.mkdir_p(File.dirname(path))
File.write(path, "fake")
expect(Streams::GenerateCoverSlate).not_to receive(:call)
described_class.ensure_for!(match)
ensure
FileUtils.rm_f(path) if defined?(path) && path
end
end