test/validation_builder_test.rb in whyvalidationssuckin96-1.3.1 vs test/validation_builder_test.rb in whyvalidationssuckin96-1.4.0
- old
+ new
@@ -57,6 +57,19 @@
should "only have one validation in the collection on the target" do
topic.validation_collection.size
end.equals(1)
end # when defining multiple validations with the same name in the one validation definition
+
+ context "register_macro" do
+ should "add a key to the registered macros constant" do
+ WhyValidationsSuckIn96::ValidationBuilder.register_macro(:this_is_a_test_macro, Class.new)
+ WhyValidationsSuckIn96::ValidationBuilder::RegisteredMacros.has_key?(:this_is_a_test_macro)
+ end
+
+ should "store the validation class in the registered macros constant" do
+ klass = Class.new
+ WhyValidationsSuckIn96::ValidationBuilder.register_macro(:this_is_another_test_macro, klass)
+ WhyValidationsSuckIn96::ValidationBuilder::RegisteredMacros[:this_is_another_test_macro].object_id == klass.object_id
+ end
+ end # register_macro
end # validation builder
\ No newline at end of file