spec/mashed/stringy_hash_spec.rb in mashed-0.5.1 vs spec/mashed/stringy_hash_spec.rb in mashed-0.9.0
- old
+ new
@@ -11,6 +11,16 @@
let(:s) { hash.stringify }
before { s[:a] = "A" }
it { expect(s[:a]).to eq("A") }
it { expect(s["a"]).to eq("A") }
end
+
+ describe "calls to_s on objects" do
+ let(:s) { hash.stringify }
+ let(:klass) {
+ Class.new do
+ def to_s; "a"; end
+ end
+ }
+ it { expect(s[klass.new]).to eq(1) }
+ end
end