spec/model_spec.rb in cistern-0.5.10 vs spec/model_spec.rb in cistern-0.6.0

- old
+ new

@@ -31,10 +31,11 @@ attribute :butternut_id, squash: ["squash", "id"], type: :integer attribute :butternut_type, squash: ["squash", "type"] attribute :squash attribute :vegetable, aliases: "squash" attribute :custom, parser: lambda { |v, _| "X!#{v}" } + attribute :default, default: "im a squash" attribute :same_alias_1, aliases: "nested" attribute :same_alias_2, aliases: "nested" attribute :same_alias_squashed_1, squash: ["nested", "attr_1"] @@ -98,9 +99,17 @@ # override intermediate processing TypeSpec.new({"squash" => {"id" => "12", "type" => "fred"}}).squash.should == {"id" => "12", "type" => "fred"} # alias of override TypeSpec.new({"squash" => {"id" => "12", "type" => "fred"}}).vegetable.should == {"id" => "12", "type" => "fred"} + end + + it "should set a default value" do + TypeSpec.new.default.should == "im a squash" + end + + it "should override a default value" do + TypeSpec.new(default: "now im a different squash").default.should == "now im a different squash" end context "allowing the same alias for multiple attributes" do it "should do so when not squashing" do type_spec = TypeSpec.new({"nested" => "bamboo"})