Sha256: cefdaca40138e4d1f6b545bb33dc66d2c12d2e8cab1513cebe65be42ef30f058

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 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, :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

4 entries across 4 versions & 2 rubygems

Version Path
mack-notifier-0.8.3.1 lib/gems/validatable-1.6.7/test/unit/validates_format_of_test.rb
mack-notifier-0.8.2 lib/gems/validatable-1.6.7/test/unit/validates_format_of_test.rb
mack-notifier-0.8.3 lib/gems/validatable-1.6.7/test/unit/validates_format_of_test.rb
validatable-1.6.7 test/unit/validates_format_of_test.rb