Sha256: 768a87e3f8338aea5f8b38d0ff02f468bbaef024ee09a7257b33729800cf770f

Contents?: true

Size: 477 Bytes

Versions: 1

Compression:

Stored size: 477 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

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-rspec-1.2.1 spec/unit/validations_spec.rb