require "rails_helper" RSpec.describe "Auth API", type: :request do let!(:user) { User.create!(email: "test@example.com", name: "Test", password: "password123", role: "coach") } it "logs in with valid credentials" do post "/api/v1/auth/login", params: { email: user.email, password: "password123" } expect(response).to have_http_status(:ok) expect(JSON.parse(response.body)).to have_key("access_token") end it "rejects invalid credentials" do post "/api/v1/auth/login", params: { email: user.email, password: "wrong" } expect(response).to have_http_status(:unauthorized) end end