Sha256: 3db3e53063b11a1bc7a2cbcb4827d8e716c196e0e052f80a86e72f60f92789d0

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

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

class ValidateUniquenessMatcherTest < Minitest::Test
  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.1.0 test/cases/validate_uniqueness_matcher_test.rb