spec/property_registry_spec.rb in vj-sdk-0.6.4 vs spec/property_registry_spec.rb in vj-sdk-0.6.5

- old
+ new

@@ -35,15 +35,24 @@ class ::DateRegistry include Videojuicer::Resource::PropertyRegistry property :date, DateTime end + + class ::InvalidAttributeRegistry + + include Videojuicer::Resource::PropertyRegistry + + property :foo, String + end + end before(:each) do @example_registry = ::FooAttributeRegistry.new @example_private_prop_registry = ::PrivatePropertyRegistry.new @date_registry = ::DateRegistry.new + end it "registers an attribute with a type at the class scope" do ::FooAttributeRegistry.attributes.should include(:integer) ::FooAttributeRegistry.attributes.should include(:string) @@ -148,7 +157,17 @@ created = ::NameConditionTestRegistry.new created.attributes = {:name=>"name set", :email=>"gooooo"} created.name.should == "name set" created.email.should == "gooooo" end + + it "allows you to set arbitrary attributes" do + lambda { ::InvalidAttributeRegistry.new({:bar => 'bar'}) }.should_not raise_error(NoMethodError) + end + + it "should store invalid attributes in a separate hash" do + invalid = ::InvalidAttributeRegistry.new({:bar => 'bar'}) + invalid.invalid_attributes.should_not == {} + end + end end \ No newline at end of file