Sha256: 3813981a1a895f78410687ae6e53b9556702342ca658a24a0e9e37c8ffc1f01f

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Fear::Option::Mixin do
  include Fear::Option::Mixin

  describe "Option()" do
    context "value is nil" do
      subject { Option(nil) }

      it { is_expected.to eq(Fear.none) }
    end

    context "value is not nil" do
      subject { Option(42) }

      it { is_expected.to eq(Fear.some(42)) }
    end
  end

  describe "Some()" do
    context "value is nil" do
      subject { Some(nil) }

      it { is_expected.to eq(Fear::Some.new(nil)) }
    end

    context "value is not nil" do
      subject { Option(42) }

      it { is_expected.to eq(Fear::Some.new(42)) }
    end
  end

  describe "None()" do
    subject { None() }

    it { is_expected.to eq(Fear::None) }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fear-3.0.0 spec/fear/option/mixin_spec.rb
fear-2.0.1 spec/fear/option/mixin_spec.rb
fear-2.0.0 spec/fear/option/mixin_spec.rb
fear-1.2.0 spec/fear/option/mixin_spec.rb
fear-1.1.0 spec/fear/option/mixin_spec.rb