Sha256: 619ca58da7b2ee8805b234b89e61e24bdb62d4b63e48f42b7c153f4d8e573b52
Contents?: true
Size: 977 Bytes
Versions: 2
Compression:
Stored size: 977 Bytes
Contents
require 'test_helper' class ValidateFormatMatcherTest < MiniTest::Unit::TestCase test 'raises ArgumentError when no option is given' do assert_raises(ArgumentError) { assert_must validate_format_of(:email), User} end test 'raises if to_allow and to_not_allow are used' do assert_raises RuntimeError do assert_must validate_format_of(:email).to_allow('').to_not_allow(''), User end end test 'must validate valid format of an attribute' do assert_must validate_format_of(:email).to_allow('foo@bar.com'), User end test 'must not validate valid format of an attribute' do assert_wont validate_format_of(:email).to_allow('foo_bar_com'), User end test 'must validate invalid format of an attribute' do assert_must validate_format_of(:email).to_not_allow('foo_bar_com'), User end test 'must not validate invalid format of an attribute' do assert_wont validate_format_of(:email).to_not_allow('foo@bar.com'), User end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
minitest-activemodel-1.0.0 | test/cases/validate_format_matcher_test.rb |
minitest-activemodel-0.0.1 | test/cases/validate_format_matcher_test.rb |