mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Add spec for user model
This commit is contained in:
parent
2995460e97
commit
7b93ca723f
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory :user do
|
||||
email "test@example.com"
|
||||
password_digest ""
|
||||
password_digest "password"
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
require 'rails_helper'
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe User, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
it { is_expected.to validate_presence_of(:email) }
|
||||
it { is_expected.to validate_presence_of(:password_digest) }
|
||||
|
||||
it 'validates uniqueness of email' do
|
||||
create(:user, email: 'test@example.com')
|
||||
user = User.new(email: 'test@example.com')
|
||||
|
||||
expect(user).to validate_uniqueness_of(:email)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user