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>
71 lines
2.4 KiB
Ruby
71 lines
2.4 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Public team page", type: :request do
|
|
let(:club) { Club.create!(name: "Team MLTV", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
|
|
let!(:team) do
|
|
club.teams.create!(
|
|
name: "Team MLTV U15",
|
|
sport_key: "pallavolo",
|
|
description: "Squadra giovanile under 15.",
|
|
roster_public: true
|
|
)
|
|
end
|
|
|
|
it "è accessibile senza login" do
|
|
get public_team_page_path(team.slug)
|
|
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.body).to include("Team MLTV U15")
|
|
expect(response.body).to include("Team MLTV")
|
|
expect(response.body).to include("Squadra giovanile under 15")
|
|
end
|
|
|
|
it "restituisce 404 per slug inesistente" do
|
|
get public_team_page_path("squadra-inesistente")
|
|
|
|
expect(response).to have_http_status(:not_found)
|
|
end
|
|
|
|
it "mostra l'organico solo se roster_public è attivo" do
|
|
team.roster_members.create!(full_name: "Mario Rossi", category: "player", jersey_number: 7)
|
|
|
|
get public_team_page_path(team.slug)
|
|
expect(response.body).to include("Mario Rossi")
|
|
|
|
team.update!(roster_public: false)
|
|
|
|
get public_team_page_path(team.slug)
|
|
expect(response.body).not_to include("Mario Rossi")
|
|
expect(response.body).not_to include("Organico")
|
|
end
|
|
end
|
|
|
|
RSpec.describe "Public team directory", type: :request do
|
|
let(:club) { Club.create!(name: "Team MLTV", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
|
|
let(:user) { User.create!(email: "dir2@test.com", name: "Coach", password: "Password123", role: "coach") }
|
|
let!(:team) { club.teams.create!(name: "Team MLTV U15", sport_key: "pallavolo") }
|
|
|
|
before do
|
|
club.club_memberships.create!(user: user, role: "owner")
|
|
match = team.matches.create!(opponent_name: MatchLiveTv::Demo::AWAY_TEAM, sport_key: "pallavolo", scheduled_at: 1.day.from_now)
|
|
StreamSession.create!(
|
|
match: match, user: user, status: "live", platform: "matchlivetv",
|
|
privacy_status: "public", publish_token: "tok-dir", started_at: Time.current
|
|
)
|
|
end
|
|
|
|
it "elenca le squadre attive senza login" do
|
|
get public_team_pages_path
|
|
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.body).to include("Team MLTV U15")
|
|
expect(response.body).to include("In diretta")
|
|
end
|
|
|
|
it "filtra per sport via query string" do
|
|
get public_team_pages_path(sport: "basket")
|
|
|
|
expect(response.body).not_to include("Team MLTV U15")
|
|
end
|
|
end
|