From 6d02dc280bbffe314877b2eebb4acb97eef8957b Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 16 Aug 2024 19:52:01 -0400 Subject: [PATCH] Add GuestUser model --- app/models/guest_user.rb | 3 +++ app/models/user.rb | 2 ++ test/models/guest_user_test.rb | 11 +++++++++++ test/models/user_test.rb | 10 +++++++--- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 app/models/guest_user.rb create mode 100644 test/models/guest_user_test.rb diff --git a/app/models/guest_user.rb b/app/models/guest_user.rb new file mode 100644 index 0000000..9f6dbd1 --- /dev/null +++ b/app/models/guest_user.rb @@ -0,0 +1,3 @@ +class GuestUser + def registered? = false +end diff --git a/app/models/user.rb b/app/models/user.rb index d67da20..1d74647 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ class User < ApplicationRecord has_secure_password + + def registered? = true end diff --git a/test/models/guest_user_test.rb b/test/models/guest_user_test.rb new file mode 100644 index 0000000..3977273 --- /dev/null +++ b/test/models/guest_user_test.rb @@ -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 diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 5c07f49..5f29df7 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -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