test/functional/validatable_test.rb in validatable-1.6.3 vs test/functional/validatable_test.rb in validatable-1.6.4

- old
+ new

@@ -1,13 +1,26 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') functional_tests do - expect :is_set do klass = Class.new do include Validatable + attr_accessor :result + before_validation do + self.result = :is_set + end + end + + instance = klass.new + instance.valid? + instance.result + end + + expect :is_set do + klass = Class.new do + include Validatable attr_accessor :name, :result - validates_presence_of :name, :after_validate => lambda { |result, instance, attribute| instance.result = :is_set } + validates_presence_of :name, :after_validate => lambda { |result, attribute| self.result = :is_set } end instance = klass.new instance.valid? instance.result