Check authentication on each request #26

Merged
atomaka merged 5 commits from guest-user into main 2024-08-16 19:59:30 -04:00
4 changed files with 23 additions and 3 deletions
Showing only changes of commit 6d02dc280b - Show all commits

3
app/models/guest_user.rb Normal file
View file

@ -0,0 +1,3 @@
class GuestUser
def registered? = false
end

View file

@ -1,3 +1,5 @@
class User < ApplicationRecord
has_secure_password
def registered? = true
end

View file

@ -0,0 +1,11 @@
require "test_helper"
class GuestUserTest < ActiveSupport::TestCase
setup do
@user = GuestUser.new
end
def test_registered_false
assert_not @user.registered?
end
end

View file

@ -1,7 +1,11 @@
require "test_helper"
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
setup do
@user = users(:one)
end
def test_registered_true
assert @user.registered?
end
end