Sha256: 784c5c4cb3b742c422bb3afa4992042acc47b0777bdaaf712d7763ac22da7232

Contents?: true

Size: 777 Bytes

Versions: 9

Compression:

Stored size: 777 Bytes

Contents

RSpec.describe Mutest::AST::Regexp::Transformer::LookupTable do
  subject(:pair) { mapper.new(s(:regexp_fake)).pair }

  let(:table) { instance_double(described_class::Table) }
  let(:token) { ::Regexp::Token.new  }
  let(:klass) { ::Regexp::Expression }

  let(:mapping) do
    described_class::Mapping.new(token, klass)
  end

  let(:mapper) do
    fake_table = table

    Class.new do
      include Concord.new(:node), Mutest::AST::Regexp::Transformer::LookupTable

      const_set(:TABLE, fake_table)

      def pair
        [expression_token, expression_class]
      end
    end
  end

  before do
    allow(table).to receive(:lookup).with(:regexp_fake).and_return(mapping)
  end

  it 'constructs regexp lookup table' do
    expect(pair).to eql([token, klass])
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutest-0.0.10 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.9 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.8 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.7 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.6 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.5 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.4 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.3 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb
mutest-0.0.2 spec/unit/mutest/ast/regexp/transformer/lookup_table_spec.rb