Sha256: dafaa49e1e2478a282149c0f8e9b5440ccaf0696f585b915f9fe4a805f821615

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

require 'test_helper'
require 'ar_test_helper'
require 'models/person'

class ValidateUniquenessMatcherTest < MiniTest::Unit::TestCase
  test 'must validate uniqueness of an attribute' do
    assert_must validate_uniqueness_of(:email), Person
  end

  test 'must not validate uniqueness of an attribute' do
    assert_wont validate_uniqueness_of(:not_unique), Person
  end

  test 'must validate scope of an unique attribute' do
    assert_must validate_uniqueness_of(:email).scoped_to(:site), Person
  end

  test 'must not validate scope of an unique attribute' do
    assert_wont validate_uniqueness_of(:email).scoped_to(:none), Person
  end

  test 'must validate uniqueness validation does not check case' do
    assert_must validate_uniqueness_of(:email).case_insensitive, Person
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minitest-activemodel-1.0.0 test/cases/validate_uniqueness_matcher_test.rb