Sha256: 7c93f41a680507dd70032358e22991df422df35e3ec557bfc10955adf9e1b10d

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 Bytes

Contents

# == Schema Information
#
# Table name: got_fixed_users
#
#  id         :integer          not null, primary key
#  email      :string(255)
#  created_at :datetime
#  updated_at :datetime
#

require 'spec_helper'

module GotFixed
  describe User do
    it "should not be valid with an empty email" do
      user = User.new :email => ""
      user.should_not be_valid
    end

    it "should not be valid with an invalid email address" do
      user = User.new :email => "foo"
      user.should_not be_valid
    end

    it "should not be able to create 2 users with the same email" do
      User.create! :email => "foo@bar.com"
      expect { User.create! :email => "foo@bar.com" }.to raise_error ActiveRecord::RecordInvalid
    end

    it "should be valid with a valid email address" do
      user = User.new :email => "seb@saunier.me"
      user.should be_valid
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
got_fixed-0.1.0 spec/models/got_fixed/user_spec.rb
got_fixed-0.0.6 spec/models/got_fixed/user_spec.rb
got_fixed-0.0.5 spec/models/got_fixed/user_spec.rb
got_fixed-0.0.4 spec/models/got_fixed/user_spec.rb
got_fixed-0.0.3 spec/models/got_fixed/user_spec.rb
got_fixed-0.0.2 spec/models/got_fixed/user_spec.rb
got_fixed-0.0.1 spec/models/got_fixed/user_spec.rb