1
0
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:
Daniel Barber 2015-10-26 12:15:46 +00:00
parent 2995460e97
commit 7b93ca723f
2 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,6 @@
FactoryGirl.define do FactoryGirl.define do
factory :user do factory :user do
email "test@example.com" email "test@example.com"
password_digest "" password_digest "password"
end end
end end

View File

@ -1,5 +1,13 @@
require 'rails_helper' require 'spec_helper'
RSpec.describe User, type: :model do 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 end