Sha256: dba0ce634861eb2966839b0d3f878345f79e9c1795aaed3b4e14f2e65d4f7f16

Contents?: true

Size: 875 Bytes

Versions: 3

Compression:

Stored size: 875 Bytes

Contents

require "spec_helper"
include Ribimaybe::Maybe
describe "Bugs" do
  describe "issue17" do
    it do
      result = Just(1).bind{ |x|
        Nothing.bind{ |y|
          rturn(x + y)
        }
      }
      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
                   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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ribimaybe-0.1.0 spec/bug_spec.rb
ribimaybe-0.0.13 spec/bug_spec.rb
ribimaybe-0.0.12 spec/bug_spec.rb