Sha256: 0ccec31df8c3802ec171bfa6410e04307a7c73398f918371f7069eab1e00c4e4

Contents?: true

Size: 944 Bytes

Versions: 2

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Mutant::Isolation::Result do
  describe '#success?' do
    let(:value) { double('Object') }

    def apply
      effective_class.new(value).success?
    end

    context 'on success instance' do
      let(:effective_class) { described_class::Success }

      it 'returns true' do
        expect(apply).to be(true)
      end
    end

    context 'on error instance' do
      let(:effective_class) { described_class::Exception }

      it 'returns false' do
        expect(apply).to be(false)
      end
    end
  end

  describe 'add_error' do
    let(:other)  { described_class::Success.new(object) }
    let(:value)  { double('Object')                     }
    let(:object) { described_class::Success.new(value)  }

    def apply
      object.add_error(other)
    end

    it 'returns chain instance' do
      expect(apply).to eql(described_class::ErrorChain.new(other, object))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.8.24 spec/unit/mutant/isolation/result_spec.rb
mutant-0.8.23 spec/unit/mutant/isolation/result_spec.rb