Sha256: 903c40fc6f4dd9313cd430f88b2867037a3f0ab01b106c2a6621b8ae68a059f1
Contents?: true
Size: 997 Bytes
Versions: 8
Compression:
Stored size: 997 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') module Unit class ValidatableTest < Test::Unit::TestCase expect false do validation = stub_everything(:should_validate? => true, :attribute => "attribute", :level => 1, :groups => []) klass = Class.new do include Validatable validations << validation end klass.new.valid? end expect true do klass = Class.new do include Validatable end instance = klass.new instance.errors.add(:attribute, "message") instance.valid? instance.errors.empty? end expect false do klass = Class.new do include Validatable end klass.validation_keys_include?("anything") end expect true do validation = stub_everything(:key => "key") klass = Class.new do include Validatable validations << validation end klass.validation_keys_include?("key") end end end
Version data entries
8 entries across 8 versions & 1 rubygems