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