Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Commit

Permalink
More specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Zubkov committed Aug 11, 2013
1 parent 18bf8ea commit e1ccd22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class User < ActiveRecord::Base
validates :email, immutable: true
validates :email, presence: true

# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
# :token_authenticatable, :lockable and :timeoutable
devise :confirmable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

Expand Down
6 changes: 6 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
require 'spec_helper'

describe User do
it { should have_db_index(:confirmation_token).unique(true) }
it { should have_db_index(:email).unique(true) }
it { should have_db_index(:reset_password_token).unique(true) }

it { should validate_presence_of :email }

it 'should return login on User.login' do
User.new(email: 'icesik@altlinux.org').login.should eq('icesik')
end
Expand Down

0 comments on commit e1ccd22

Please sign in to comment.