Sha256: 1e2742606f7ef890213b0d82e9205b6b59ecb350d025d1ad4626aed61495522b

Contents?: true

Size: 479 Bytes

Versions: 7

Compression:

Stored size: 479 Bytes

Contents

require 'spec_helper'

describe "Validations" do
  describe User do
    it { should validate_presence_of(:login) }
    it { should validate_uniqueness_of(:login) }    
    it { should validate_format_of(:login).to_allow("valid_login").not_to_allow("invalid login") }
    it { should validate_associated(:profile) }
    it { should validate_inclusion_of(:role).to_allow("admin", "member") }
  end
  
  describe Profile do
    it { should validate_numericality_of(:age) }
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
mongoid-rspec-1.2.0 spec/unit/validations_spec.rb
mongoid-rspec-1.1.2 spec/unit/validations_spec.rb
mongoid-rspec-1.1.1 spec/unit/validations_spec.rb
mongoid-rspec-1.1.0 spec/unit/validations_spec.rb
mongoid-rspec-1.0.4 spec/unit/validations_spec.rb
mongoid_rspec_ign-1.0.3 spec/unit/validations_spec.rb
mongoid-rspec-1.0.3 spec/unit/validations_spec.rb