Sha256: 9238993d416711daaf119a5a45f7babfa240946ab5f90a975864279401aeef31

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

RSpec.describe Mutant::AST::Regexp::Transformer do
  before do
    stub_const("#{described_class}::REGISTRY", Mutant::Registry.new)
  end

  it 'registers types to a given class' do
    klass = Class.new(described_class) { register(:regexp_bos_anchor) }

    expect(described_class.lookup(:regexp_bos_anchor)).to be(klass)
  end

  it 'rejects duplicate registrations' do
    Class.new(described_class) { register(:regexp_bos_anchor) }

    expect { Class.new(described_class) { register(:regexp_bos_anchor) } }
      .to raise_error(Mutant::Registry::RegistryError)
      .with_message('Duplicate type registration: :regexp_bos_anchor')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.8.16 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.15 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.14 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.13 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.12 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.11 spec/unit/mutant/ast/regexp/transformer_spec.rb