Sha256: 82e68854d8088d3825219ca8e97c58ca0d06b6d20e41cbafa5a2a20949d67cea

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 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
                   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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ribimaybe-0.0.11 spec/bug_spec.rb