spec/option_spec.rb in option-0.3.0 vs spec/option_spec.rb in option-0.3.1
- old
+ new
@@ -65,10 +65,16 @@
end
it "should be aliased to None" do
None.must_be_instance_of(NoneClass)
end
+
+ it "#inside should return itself without invoking the block" do
+ expected = nil
+ None.inside { |v| expected = value }
+ expected.must_be_nil
+ end
end
describe SomeClass do
it "#to_a returns the value wrapped in an array" do
@@ -137,9 +143,15 @@
Some(value).fold(proc { value * 2 }) { |v| v * 3 }.must_equal(36)
end
it "#filter should return itself" do
None.filter { |i| i == 0 }.must_equal(None)
+ end
+
+ it "#inside should invoke the proc and return itself" do
+ expected = nil
+ Some(value).inside { |v| expected = v }.must_equal(Some(value))
+ expected.must_equal(value)
end
it "should wrap the creation of a Some" do
Some(value).must_be_instance_of(SomeClass)
end