Sha256: f07d5d8bd483bb833fc32fdd8b17becf7c45b7041de2fe517e5625ba25287af9

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

require "spec_helper"
include Ribimaybe::Maybe
describe Ribimaybe::Maybe do
  describe ".maybe" do
    context "when i have nothing" do
      it "should give me back a default" do
        expect(Nothing.maybe(false) { |_| true }).to eq(false)
      end
    end
  end

  describe "#maybe" do
    context "when i have something" do
      it "should give me back something" do
        expect(Just(:x).maybe(:y) { |x| x }).to eq(:x)
      end
    end
  end

  describe "#Maybe()" do
    context "when i have nil" do
      it "should give me back nothing" do
        expect(Maybe(nil)).to eq(Nothing)
      end
    end

    context "when i have :x" do
      it "should give me back just :x" do
        expect(Maybe(:x)).to eq(Just(:x))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ribimaybe-0.1.0 spec/maybe_spec.rb
ribimaybe-0.0.13 spec/maybe_spec.rb
ribimaybe-0.0.12 spec/maybe_spec.rb
ribimaybe-0.0.11 spec/maybe_spec.rb
ribimaybe-0.0.10 spec/maybe_spec.rb
ribimaybe-0.0.9 spec/maybe_spec.rb