Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
backend/spec/services/webhooks/mediamtx_handler_spec.rb
Normal file
24
backend/spec/services/webhooks/mediamtx_handler_spec.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Webhooks::MediamtxHandler do
|
||||
let(:user) { User.create!(email: "c@test.com", name: "C", password: "password123", role: "coach") }
|
||||
let(:team) { Team.create!(name: "T") }
|
||||
let!(:match) { team.matches.create!(opponent_name: "Away") }
|
||||
let!(:session) do
|
||||
StreamSession.create!(
|
||||
match: match, user: user, status: "live", platform: "youtube",
|
||||
publish_token: "tok", started_at: Time.current
|
||||
)
|
||||
end
|
||||
|
||||
it "transitions to reconnecting on disconnect" do
|
||||
described_class.new(event: "disconnect", session_id: session.id).call
|
||||
expect(session.reload.status).to eq("reconnecting")
|
||||
end
|
||||
|
||||
it "returns to live on reconnect" do
|
||||
session.update!(status: "reconnecting")
|
||||
described_class.new(event: "connect", session_id: session.id).call
|
||||
expect(session.reload.status).to eq("live")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user