Introduce architettura multi-sport con catalogo, engine scoring e overlay.
Catalogo sport in YAML, board implicito, engine per volley/basket/timed/racket/timer/generic, regia e app Android allineate. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
19
backend/spec/requests/api/v1/sports_spec.rb
Normal file
19
backend/spec/requests/api/v1/sports_spec.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe "Api::V1::Sports", type: :request do
|
||||
let!(:user) { User.create!(email: "s@example.com", password: "secret123", name: "U", role: "coach") }
|
||||
|
||||
it "GET /api/v1/sports restituisce il catalogo" do
|
||||
post "/api/v1/auth/login", params: { email: user.email, password: "secret123" }
|
||||
token = response.parsed_body["access_token"]
|
||||
get "/api/v1/sports", headers: { "Authorization" => "Bearer #{token}" }
|
||||
expect(response).to have_http_status(:ok)
|
||||
body = JSON.parse(response.body)
|
||||
expect(body).to be_an(Array)
|
||||
pallavolo = body.find { |s| s["key"] == "pallavolo" }
|
||||
expect(pallavolo["board"]).to eq("volley")
|
||||
expect(pallavolo["allowed_overlays"]).to include("volley", "timer", "none")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user