Permalink
Browse files

Add missing coercion_method option to Attribute::Object

[closes #19]
  • Loading branch information...
1 parent 3e2ee87 commit b7c4d5f604ff29904bb1eaa3bb348b4ad5719e39 @solnic committed Jul 31, 2011
Showing with 9 additions and 1 deletion.
  1. +2 −1 lib/virtus/attribute/object.rb
  2. +7 −0 spec/integration/virtus/class_methods/attribute_spec.rb
@@ -3,7 +3,8 @@ class Attribute
# Base class for every attribute
class Object < Attribute
- primitive ::Object
+ primitive ::Object
+ coercion_method :to_object
end # class Object
end # class Attribute
@@ -5,6 +5,13 @@
Class.new { include Virtus }
end
+ (Virtus::Attribute.descendants + [Virtus::Attribute::Object]).each do |attribute_class|
+ context "with #{attribute_class.inspect}" do
+ subject { described_class.attribute(:name, attribute_class) }
+ specify { subject.attributes[:name].should be_instance_of(attribute_class) }
+ end
+ end
+
specify { described_class.should respond_to(:attribute) }
context "in the class" do

0 comments on commit b7c4d5f

Please sign in to comment.