Sha256: c86c80b5db93925b49359479bef1f10db682063c94b6f79c3f44dff5aa69a30b

Contents?: true

Size: 985 Bytes

Versions: 3

Compression:

Stored size: 985 Bytes

Contents

RSpec.describe Mutant::Isolation::None do
  before do
    @initial = 1
  end

  describe '.run' do
    let(:object) { described_class }

    it 'does not isolate side effects' do
      object.call { @initial = 2 }
      expect(@initial).to be(2)
    end

    it 'return block value' do
      expect(object.call { :foo }).to be(:foo)
    end

    it 'wraps *all* exceptions' do
      expect { object.call { fail  } }.to raise_error(Mutant::Isolation::Error)
    end

  end
end

RSpec.describe Mutant::Isolation::Fork do
  before do
    @initial = 1
  end

  describe '.run' do
    let(:object) { described_class }

    it 'does isolate side effects' do
      object.call { @initial = 2  }
      expect(@initial).to be(1)
    end

    it 'return block value' do
      expect(object.call { :foo }).to be(:foo)
    end

    it 'wraps Parallel::DeadWorker exceptions' do
      expect { object.call { fail Parallel::DeadWorker } }.to raise_error(Mutant::Isolation::Error)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutant-0.6.3 spec/unit/mutant/isolation_spec.rb
mutant-0.6.2 spec/unit/mutant/isolation_spec.rb
mutant-0.6.0 spec/unit/mutant/isolation_spec.rb