Add GuestUser model
This commit is contained in:
parent
61f3d34653
commit
6d02dc280b
4 changed files with 23 additions and 3 deletions
3
app/models/guest_user.rb
Normal file
3
app/models/guest_user.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class GuestUser
|
||||||
|
def registered? = false
|
||||||
|
end
|
|
@ -1,3 +1,5 @@
|
||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
has_secure_password
|
has_secure_password
|
||||||
|
|
||||||
|
def registered? = true
|
||||||
end
|
end
|
||||||
|
|
11
test/models/guest_user_test.rb
Normal file
11
test/models/guest_user_test.rb
Normal 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
|
|
@ -1,7 +1,11 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
class UserTest < ActiveSupport::TestCase
|
class UserTest < ActiveSupport::TestCase
|
||||||
# test "the truth" do
|
setup do
|
||||||
# assert true
|
@user = users(:one)
|
||||||
# end
|
end
|
||||||
|
|
||||||
|
def test_registered_true
|
||||||
|
assert @user.registered?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue