Sha256: d9d09ebb118e9b38e5f2b2d3c8615e6348e4b555c0678259ba677d174bb8d3e6

Contents?: true

Size: 1.87 KB

Versions: 21

Compression:

Stored size: 1.87 KB

Contents

# == Schema Information
#
# Table name: users
#
#  id                     :integer          not null, primary key
#  login                  :string(20)       not null
#  email                  :string(255)
#  first_name             :string(60)
#  last_name              :string(60)
#  sign_in_count          :integer          default(0), not null
#  failed_attempts        :integer          default(0), not null
#  last_request_at        :datetime
#  current_sign_in_at     :datetime
#  last_sign_in_at        :datetime
#  current_sign_in_ip     :string(255)
#  last_sign_in_ip        :string(255)
#  created_at             :datetime
#  updated_at             :datetime
#  encrypted_password     :string(255)
#  confirmation_token     :string(255)
#  confirmed_at           :datetime
#  confirmation_sent_at   :datetime
#  reset_password_token   :string(255)
#  reset_password_sent_at :datetime
#  remember_token         :string(255)
#  remember_created_at    :datetime
#  unlock_token           :string(255)
#  locked_at              :datetime
#

require 'spec_helper'

describe User do
  describe "validations" do
    describe "uniqueness" do
      it "should not create two users with the same email" do
        user_1 = FactoryGirl.create(:user, :email => 'foo@foo.com')
        user_2 = FactoryGirl.build(:user, :email => 'foo@foo.com')
        expect(user_1).to be_valid
        expect(user_2).not_to be_valid
      end
    end

    describe "email confirmation" do
      it "validations confirmation on create" do
        user = FactoryGirl.build(:user, :email => 'foo@foo.com', :email_confirmation => "bar@bar.com")
        expect(user).not_to be_valid
      end

      it "can update without checking confirmation" do
        user = FactoryGirl.create(:user, :email => 'foo@foo.com')
        user.reload
        user.email = "bar@bar.com"
        expect(user).to be_valid
      end
    end
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
xing-framework-1.0.0.pre.beta.1 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-1.0.0.pre.beta default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-1.0.0.pre.alpha default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.3.2 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.3.1 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.3.0 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.9 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.9.beta1 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.8 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.8.beta1 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.7 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.7.pre.beta1 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.6 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.5 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.4 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.3 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.2 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.1 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.2.0 default_configuration/base_app/backend/spec/models/user_spec.rb
xing-framework-0.0.3 default_configuration/base_app/backend/spec/models/user_spec.rb