spec/unit/render/dottable_hash_spec.rb in render-0.0.2 vs spec/unit/render/dottable_hash_spec.rb in render-0.0.3
- old
+ new
@@ -125,25 +125,22 @@
dottable_hash.foo.first.bar.first.class.should == DottableHash
end
end
describe "#fetch" do
- it "raises KeyErrors" do
- lambda {
- DottableHash.new.fetch("non_existent_key")
- }.should raise_error
- end
-
it "returns dottable_hashs in lieu of hashes" do
@dottable_hash["nested_hash"] = { "foo" => "bar" }
@dottable_hash.fetch("nested_hash").class.should == DottableHash
end
it "returns value of corresponding key object" do
@dottable_hash["foo"] = "bar"
@dottable_hash.fetch("foo").should == "bar"
end
+ it "accepts default value" do
+ DottableHash.new({ baz: "buz" }).fetch(:foo, :bar).should == :bar
+ end
end
describe "#fetch_path[!]" do
it "returns value of corresponding key object" do
@dottable_hash["foo"] = "bar"