# frozen_string_literal: true require "rails_helper" RSpec.describe Youtube::LivePipeline do let(:user) { User.create!(email: "ytpipe@test.it", name: "U", password: "Password123", role: "coach") } let(:club) { Club.create!(name: "C", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") } let(:team) { club.teams.create!(name: "T", sport: "volleyball") } let(:match) { team.matches.create!(opponent_name: "Opp", sport: "volleyball") } let(:session) do StreamSession.create!( match: match, user: user, platform: "youtube", status: "live", youtube_broadcast_id: "bcast", stream_key: "yt-key" ) end let(:client) { instance_double(Mediamtx::Client) } before do allow(Mediamtx::Client).to receive(:for_session).and_return(client) allow(Mediamtx::PublisherOnline).to receive(:active?).and_return(true) allow(Streams::YoutubeRelay).to receive(:ensure_publishing!) allow(Streams::YoutubeRelay).to receive(:running?).and_return(true) allow(described_class).to receive(:schedule!) allow(described_class).to receive(:schedule_activate!) allow(client).to receive(:set_always_available) end it "non spegne la slate quando il publisher รจ online" do described_class.tick_session!(session) expect(client).not_to have_received(:set_always_available) end end