Skip to content

Commit

Permalink
one last edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
fermion committed Jan 14, 2024
1 parent 80a127d commit f15e523
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def register
else
redirect_to auth_sign_in_url, notice: "Sorry, that link is invalid."
end
rescue Registration::RegistrationNotAvailableError
redirect_to auth_sign_in_url, notice: "Sorry, that link is invalid."
end

private
Expand Down
10 changes: 10 additions & 0 deletions spec/system/signup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,14 @@
end
end
end

context "when a registration has already been used" do
it "should redirect the user to the sign in page" do
registration = create(:registration, registered_at: Time.current)
visit register_registration_path(registration, token: registration.token)

expect(page).to have_current_path(auth_sign_in_path)
expect(page).to have_content("Sorry, that link is invalid.")
end
end
end

0 comments on commit f15e523

Please sign in to comment.