Sha256: f8ea8f7e54493fc558c2c9f8c441d0019bf8a6db0e84107a7523f95bb08435df

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 Bytes

Contents

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

  describe 'Option()' do
    it 'returns Some if value is not nil' do
      option = Option(double)

      expect(option).to be_kind_of(Fear::Some)
    end

    it 'returns None if value is nil' do
      option = Option(nil)

      expect(option).to be_kind_of(Fear::None)
    end
  end

  let(:some) { Some(42) }
  let(:none) { None() }

  describe '#empty?' do
    context 'Some' do
      subject { some.empty? }
      it { is_expected.to eq(false) }
    end

    context 'None' do
      subject { none.empty? }
      it { is_expected.to eq(true) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fear-0.1.0 spec/fear/option_spec.rb
fear-0.0.1 spec/fear/option_spec.rb