test/unit/validatable_test.rb in validatable-1.3.4 vs test/unit/validatable_test.rb in validatable-1.4.0
- old
+ new
@@ -1,12 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
module Unit
class ValidatableTest < Test::Unit::TestCase
expect false do
- validation = stub(:valid? => false, :should_validate? => true,
- :attribute => "attribute", :message => "message", :level => 1, :run_after_validate => nil)
+ validation = stub_everything(:valid? => false, :should_validate? => true, :attribute => "attribute", :level => 1)
klass = Class.new do
include Validatable
validations << validation
end
klass.new.valid?
@@ -19,8 +18,23 @@
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
\ No newline at end of file