Sha256: 20ce0a6574ac2395d0455170b17019b8c7f2e70fa7d6254e3e084a685195e7e7

Contents?: true

Size: 960 Bytes

Versions: 2

Compression:

Stored size: 960 Bytes

Contents

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

Expectations do
  
  expect false do
    validation = Validatable::ValidatesTrueFor.new stub_everything, :name, :logic => lambda {|*x| false }
    validation.valid?(stub_everything)
  end
  
  expect true do
    validation = Validatable::ValidatesTrueFor.new stub_everything, :name, :logic => lambda {|*x| true }
    validation.valid?(stub_everything)
  end
  
  expect ArgumentError do
    validation = Validatable::ValidatesTrueFor.new stub_everything, :age
  end
  
  expect true do
    options = [:message, :if, :times, :level, :groups, :logic, :key]
    Validatable::ValidatesTrueFor.new(stub_everything, :name, options.to_blank_options_hash).must_understand(options.to_blank_options_hash)
  end
  
  expect true do
    options = [:logic]
    Validatable::ValidatesTrueFor.new(stub_everything, :name, options.to_blank_options_hash).requires(options.to_blank_options_hash)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lgustafson-validatable-1.8.7 test/unit/test_validates_true_for.rb
lgustafson-validatable-1.8.6 test/unit/test_validates_true_for.rb