Skip to content

Instantly share code, notes, and snippets.

@MaryKuz
Created March 28, 2019 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaryKuz/1e5d7b21a6aa340a89c9c0f9831f1699 to your computer and use it in GitHub Desktop.
Save MaryKuz/1e5d7b21a6aa340a89c9c0f9831f1699 to your computer and use it in GitHub Desktop.
Cover new model with tests
require 'rails_helper'
RSpec.describe User, type: :model do
it { should have_secure_password }
it { should validate_presence_of :name }
it { should validate_presence_of :email }
it { should validate_uniqueness_of(:email).case_insensitive }
it { should_not allow_value('test').for(:email) }
it { should allow_value('test@test.com').for(:email) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment