Sha256: fe3a9b1a9df8ed0fb629a2a1fb1f7a06aca1b1777f3fea8993a348cc1792e646
Contents?: true
Size: 1.16 KB
Versions: 16
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true RSpec.describe Mutant::Registry do let(:lookup) { object.lookup(type) } let(:object) { described_class.new } let(:mutator) { class_double(Mutant::Mutator) } def register_mutator object.register(type, mutator) end context 'on registered type' do subject { register_mutator } let(:type) { :true } before { subject } it 'returns registered mutator' do expect(lookup).to be(mutator) end it_behaves_like 'a command method' context 'when registered twice' do it 'fails upon registration' do expect { register_mutator }.to raise_error(described_class::RegistryError, 'Duplicate type registration: :true') end end end context 'on unknown type' do let(:type) { :unknown } it 'raises error' do expect { lookup }.to raise_error(described_class::RegistryError, 'No entry for: :unknown') end end context 'when registering an invalid node type' do let(:type) { :invalid } it 'raises error' do expect { register_mutator }.to raise_error(described_class::RegistryError, 'Invalid type registration: :invalid') end end end
Version data entries
16 entries across 16 versions & 1 rubygems