spec/lib/optional/option/enumerable_spec.rb in optional-0.0.5 vs spec/lib/optional/option/enumerable_spec.rb in optional-0.0.6
- old
+ new
@@ -5,18 +5,18 @@
let (:cat) { Cat.new("MOGGIE!") }
let (:dog) { Dog.new("DOGGIE!") }
describe "#map_through" do
it "allows mapping through multiple methods" do
- Some[cat, dog].map_through(:name, :chars, :first).should eq Some["M", "D"]
+ Some[cat].map_through(:name, :chars, :first).should eq Some["M"]
end
end
describe "#map" do
it "maps a some to a some" do
- Some[cat, dog].map(&:name).should eq Some["MOGGIE!", "DOGGIE!"]
+ Some[cat].map(&:name).should eq Some["MOGGIE!"]
end
it "also works for collect" do
Some[cat].collect(&:name).should eq Some["MOGGIE!"]
end
@@ -58,11 +58,11 @@
describe "#juxt" do
it "collects the results of calling the passed methods" do
Some[cat].juxt(:name, :class).should eq Some["MOGGIE!", Cat]
- Some[1,2,3].juxt(:pred, :succ).should eq Some[[0, 2], [1, 3], [2, 4]]
+ Some[1].juxt(:pred, :succ).should eq Some[0, 2]
end
it "also works for nil" do
None.juxt(:name, :class).should be_none
end
@@ -141,10 +141,10 @@
it "also works as inject" do
Some[4].inject(:+).should eq 4
end
it "also works within the some" do
- Some[3,4,5].reduce(:+).should eq 12
+ Some[3,4,5].reduce(:+).should eq [3,4,5]
end
end
describe "#none?" do
it "returns true if given a block the block evaluates to false for the value" do