Sha256: e42ec6bb01cd31b9b14c07001d46c3e07b503bc50363e009faa92a4c4bea94c5

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

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

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.24 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.23 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.22 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.21 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.20 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.19 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.18 spec/unit/mutant/ast/regexp/transformer_spec.rb
mutant-0.8.17 spec/unit/mutant/ast/regexp/transformer_spec.rb