Commit 1607711b by Đường Sỹ Hoàng

Removed space

parent df049593
......@@ -11,16 +11,18 @@ class User < ApplicationRecord
has_secure_password
class << self
# Returns the hash digest of the given string.
def User.digest(string)
def digest(string)
cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost
BCrypt::Password.create(string, cost: cost)
end
# Returns a random token.
def User.new_token
def new_token
SecureRandom.urlsafe_base64
end
end
# Remembers a user in the database for use in persistent sessions
def remember
......
......@@ -15,7 +15,7 @@ class UserTest < ActiveSupport::TestCase
end
test "email should be present" do
@user.email = ""
@user.email = " "
assert_not @user.valid?
end
......@@ -62,7 +62,7 @@ class UserTest < ActiveSupport::TestCase
end
test "password should be present (nonblank)" do
@user.password = @user.password_confirmation = "" * 6
@user.password = @user.password_confirmation = " " * 6
assert_not @user.valid?
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment