Merge branch 'main' into collaudo
Porta in collaudo l'invito trasmissione con email automatica.
This commit is contained in:
@@ -4,11 +4,11 @@ RSpec.describe "Api::V1::Invitations", type: :request do
|
||||
let(:club) { Club.create!(name: "FC Test", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
|
||||
let(:team) { club.teams.create!(name: "Squadra A", sport: "volleyball") }
|
||||
let(:owner) do
|
||||
User.create!(email: "owner@test.it", name: "Owner", password: "password123", role: "coach").tap do |u|
|
||||
User.create!(email: "owner@test.it", name: "Owner", password: "Password123", role: "coach").tap do |u|
|
||||
ClubMembership.create!(user: u, club: club, role: "owner")
|
||||
end
|
||||
end
|
||||
let(:invitee) { User.create!(email: "streamer@test.it", name: "Streamer", password: "password123", role: "coach") }
|
||||
let(:invitee) { User.create!(email: "streamer@test.it", name: "Streamer", password: "Password123", role: "coach") }
|
||||
let(:token) { TeamInvitation.generate_token }
|
||||
let!(:invitation) do
|
||||
team.team_invitations.create!(
|
||||
@@ -31,7 +31,7 @@ RSpec.describe "Api::V1::Invitations", type: :request do
|
||||
|
||||
describe "POST /api/v1/invitations/:token/accept" do
|
||||
it "accetta con email corretta" do
|
||||
post "/api/v1/auth/login", params: { email: invitee.email, password: "password123" }
|
||||
post "/api/v1/auth/login", params: { email: invitee.email, password: "Password123" }
|
||||
access = response.parsed_body["access_token"]
|
||||
|
||||
post "/api/v1/invitations/#{token}/accept",
|
||||
@@ -42,7 +42,7 @@ RSpec.describe "Api::V1::Invitations", type: :request do
|
||||
end
|
||||
|
||||
it "rifiuta email diversa" do
|
||||
post "/api/v1/auth/login", params: { email: owner.email, password: "password123" }
|
||||
post "/api/v1/auth/login", params: { email: owner.email, password: "Password123" }
|
||||
access = response.parsed_body["access_token"]
|
||||
|
||||
post "/api/v1/invitations/#{token}/accept",
|
||||
|
||||
Reference in New Issue
Block a user