Blocca la seconda diretta sullo stesso utente, registra gli abusi in admin e presenta la copertina come grafica caricata dalla società, con demo Team MLTV. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.8 KiB
Ruby
48 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
RSpec.describe "Admin stream concurrency violations", type: :request do
|
|
let!(:admin) { AdminAccount.create!(username: "ops-abuse", password: "Password123") }
|
|
let!(:user) { User.create!(email: "abuse@test.it", name: "Abuser", password: "Password123", role: "coach") }
|
|
let!(:club) { Club.create!(name: "Abuse Club", sport: "volleyball") }
|
|
let!(:team) { club.teams.create!(name: "U16", sport: "volleyball") }
|
|
let!(:match_a) { team.matches.create!(opponent_name: "Rival A", sport: "volleyball") }
|
|
let!(:match_b) { team.matches.create!(opponent_name: "Rival B", sport: "volleyball") }
|
|
let!(:live) do
|
|
StreamSession.create!(match: match_a, user: user, platform: "matchlivetv", status: "live")
|
|
end
|
|
let!(:idle) do
|
|
StreamSession.create!(match: match_b, user: user, platform: "matchlivetv", status: "idle")
|
|
end
|
|
let!(:violation) do
|
|
StreamConcurrencyViolation.record!(attempted: idle, occupying: live, action: "start")
|
|
end
|
|
|
|
before do
|
|
post admin_login_path, params: { username: admin.username, password: "Password123" }
|
|
end
|
|
|
|
it "mostra l'elenco abusi" do
|
|
get admin_stream_concurrency_violations_path
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.body).to include("abuse@test.it")
|
|
expect(response.body).to include("Abuse Club")
|
|
expect(response.body).to include("Rival A")
|
|
expect(response.body).to include("Rival B")
|
|
end
|
|
|
|
it "mostra il badge in dashboard" do
|
|
get admin_root_path
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.body).to include("abuse@test.it")
|
|
end
|
|
|
|
it "mostra i tentativi nella scheda società" do
|
|
get admin_club_path(club)
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.body).to include("abuse@test.it")
|
|
expect(response.body).to include("Rival B")
|
|
end
|
|
end
|