Sha256: be90e4d5ef02e4f6ab8ff10ed36c666b547ce31ed52b2a17f885fb1400705a7c

Contents?: true

Size: 469 Bytes

Versions: 7

Compression:

Stored size: 469 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
        result = Nothing.maybe(42) { |x| x + 1 }
        expect(result).to eq 42
      end
    end

    context "when i have something" do
      it "should give me back something" do
        result = Just(42).maybe(1) { |x| x }
        expect(result).to eq 42
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ribimaybe-0.0.8 spec/maybe_spec.rb
ribimaybe-0.0.6 spec/maybe_spec.rb
ribimaybe-0.0.5 spec/maybe_spec.rb
ribimaybe-0.0.4 spec/maybe_spec.rb
ribimaybe-0.0.3 spec/maybe_spec.rb
ribimaybe-0.0.2 spec/maybe_spec.rb
ribimaybe-0.0.1 spec/maybe_spec.rb