This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
syntax on | |
filetype on | |
filetype indent on | |
set expandtab | |
set shiftwidth=2 | |
set softtabstop=2 | |
set number | |
set incsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
before_save { self.email = email.downcase } | |
EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i | |
validates :name, presence: true, length: { maximum: 50 } | |
validates :email, presence: true, format: { with: EMAIL_REGEX }, uniqueness: { case_sensitive: false } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'pry' | |
describe User do | |
before do | |
@user = User.new(name: "Example User", email: "user@example.com") | |
end | |
subject { @user } |
NewerOlder