Sha256: 3e93c9ef9c6350738cebf7e178c9ef3d3cb05a3ba33171687a3023f906c3dced

Contents?: true

Size: 483 Bytes

Versions: 7

Compression:

Stored size: 483 Bytes

Contents

require "spec_helper"
include Ribimaybe::Maybe

describe "Functor Instance" do
  describe "#map" do
    context "when i have nothing" do
      it "should give me back nothing" do
        result = Nothing.map { |x| x + 1 }
        expect(result).to eq Nothing
      end
    end

    context "when i have something" do
      it "should apply the fn and we-wrap the value" do
        result = Just(41).map { |x| x + 1 }
        expect(result).to eq Just(42)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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