spec/hashme/properties_spec.rb in hashme-0.1.1 vs spec/hashme/properties_spec.rb in hashme-0.1.2

- old
+ new

@@ -49,17 +49,27 @@ it "should be instantiated after property set" do @model.properties.should_not be_nil @model.properties.class.should eql(Hash) end - it "should be null if no properties" do + it "should be empty if no properties" do model = Class.new do include Hashme end - model.properties.should be_nil + model.properties.should be_empty end + it "should be inherited from parent models" do + mod = Class.new(@model) do + property :surname, String + end + mod.properties.keys.should include(:name) + mod.properties.keys.should include(:surname) + # Make sure we don't update the parent! + @model.properties.keys.should_not include(:surname) + end + end describe ".property" do it "should fail if no type is defined" do @@ -94,8 +104,7 @@ @model.property :name, String, :default => "Sam" @obj.name.should eql("Sam") end end - end