Sha256: 84d774fbbae39ef57aeafa72c7c005d14cbe2ad0672cc457dbb1d6bf9ebd49ba
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require "spec_helper" require "hamster/vector" describe Hamster::Vector do [:map, :collect].each do |method| describe "##{method}" do describe "when empty" do before do @original = Hamster.vector @mapped = @original.send(method) {} end it "returns self" do @mapped.should equal(@original) end end describe "when not empty" do before do @original = Hamster.vector("A", "B", "C") end describe "with a block" do before do @mapped = @original.send(method, &:downcase) end it "preserves the original values" do @original.should == Hamster.vector("A", "B", "C") end it "returns a new vector with the mapped values" do @mapped.should == Hamster.vector("a", "b", "c") end end describe "with no block" do before do @result = @original.send(method) end it "returns self" do @result.should equal(@original) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-1.0.1.pre.rc.1 | spec/hamster/vector/map_spec.rb |