spec/hamster/hash/put_spec.rb in hamster-0.3.5 vs spec/hamster/hash/put_spec.rb in hamster-0.3.6
- old
+ new
@@ -10,20 +10,21 @@
@original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see")
end
describe "with a block" do
- it "passes the key to the block" do
- @original.put("A") { |key, value| key.should == "A" }
- end
-
it "passes the value to the block" do
- @original.put("A") { |key, value| value.should == "aye" }
+ @original.put("A") { |value| value.should == "aye" }
end
it "replaces the value with the result of the block" do
- result = @original.put("A") { |key, value| "FLIBBLE" }
+ result = @original.put("A") { |value| "FLIBBLE" }
result.get("A").should == "FLIBBLE"
+ end
+
+ it "supports to_proc methods" do
+ result = @original.put("A", &:next)
+ result.get("A").should == "ayf"
end
end
describe "with a unique key" do