spec/celsius/hash_spec.rb in celsius-0.4.0 vs spec/celsius/hash_spec.rb in celsius-0.4.1

- old
+ new

@@ -55,6 +55,18 @@ expect(described_class.deep_find_key(hash, [:facets, :creator])).to eq(expected_result) end end end + + describe ".smart_store" do + it "stores a value with the given key" do + expect(described_class.smart_store({}, :key, "value")).to eq({key: "value"}) + end + + context "if the key allready exists" do + it "converts the value to an array and pushes the value to it" do + expect(described_class.smart_store({key: "foo"}, :key, "bar")).to eq({key: ["foo", "bar"]}) + end + end + end end