Sha256: 7aa36c51ba7cc1c7d9e51e2e83774bffc966ebd46aec0eafd4d65f4020c70954

Contents?: true

Size: 1.41 KB

Versions: 32

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

Expectations do
  
  expect false do
    validation = Validatable::ValidatesFormatOf.new stub_everything, :name, :with => /book/
    validation.valid?(stub_everything)
  end
  
  expect true do
    validation = Validatable::ValidatesFormatOf.new stub_everything, :name, :with => /book/
    validation.valid?(stub(:name=>"book"))
  end
  
  expect true do
    validation = Validatable::ValidatesFormatOf.new stub_everything, :name, :with => /book/, :allow_nil => true
    validation.valid?(stub(:name=>nil))
  end
  
  expect true do
    validation = Validatable::ValidatesFormatOf.new stub_everything, :name, :with => /book/, :allow_blank => true
    validation.valid?(stub(:name=>''))
  end
  
  expect true do
    validation = Validatable::ValidatesFormatOf.new stub_everything, :age, :with => /14/
    validation.valid?(stub(:age=>14))
  end
  
  expect ArgumentError do
    validation = Validatable::ValidatesFormatOf.new stub_everything, :age
  end
  
  expect true do
    options = [:message, :if, :times, :level, :groups, :with, :key]
    Validatable::ValidatesFormatOf.new(stub_everything, :test, options.to_blank_options_hash).must_understand(options.to_blank_options_hash)
  end
  
  expect true do
    options = [:with]
    Validatable::ValidatesFormatOf.new(stub_everything, :name, options.to_blank_options_hash).requires(options.to_blank_options_hash)
  end
  
end

Version data entries

32 entries across 32 versions & 9 rubygems

Version Path
hashrocket-validatable-1.7.2 test/unit/test_validates_format_of.rb
hashrocket-validatable-1.7.4 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.7.0 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.7.1 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.7.2 test/unit/test_validates_format_of.rb
ramsingla-validatable-1.7.2 test/unit/test_validates_format_of.rb
ramsingla-validatable-1.7.3 test/unit/test_validates_format_of.rb
vizjerai-validatable-1.8.0 test/unit/test_validates_format_of.rb
vizjerai-validatable-1.9.0 test/unit/test_validates_format_of.rb
lgustafson-validatable-1.8.7 test/unit/test_validates_format_of.rb
lgustafson-validatable-1.8.6 test/unit/test_validates_format_of.rb
np422-validatable-1.8.5 test/unit/test_validates_format_of.rb
erotte-validatable-1.8.5 test/unit/test_validates_format_of.rb
mattmatt-validatable-1.8.4 test/unit/test_validates_format_of.rb
mattmatt-validatable-1.8.3 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.8.4 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.8.3 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.8.2 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.1.10 test/unit/test_validates_format_of.rb
jnunemaker-validatable-1.1.9 test/unit/test_validates_format_of.rb