spec/bug_spec.rb in ribimaybe-0.0.10 vs spec/bug_spec.rb in ribimaybe-0.0.11
- old
+ new
@@ -9,6 +9,35 @@
}
}
expect(result).to eq(Nothing)
end
end
+
+ describe "issue19" do
+ context "when i have nothing" do
+ it do
+ x = Nothing
+ result = case x
+ when Just
+ binding.pry
+ x.maybe(:x) { |x| x }
+ when Nothing
+ :nothing
+ end
+ expect(result).to eq(:nothing)
+ end
+ end
+
+ context "when i have just :x" do
+ it do
+ x = Just(:x)
+ result = case x
+ when Just
+ x.maybe(:x) { |x| x }
+ when Nothing
+ :nothing
+ end
+ expect(result).to eq(:x)
+ end
+ end
+ end
end