Sha256: 1c3caf9070c23d93058de49f3cc6e9f559f5a6e8da17e5317b6a25a2d406be04

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

RSpec.describe Mutest::Expression::Method do
  let(:object)           { parse_expression(input)   }
  let(:env)              { Fixtures::TEST_ENV        }
  let(:instance_method)  { 'TestApp::Literal#string' }
  let(:singleton_method) { 'TestApp::Literal.string' }

  describe '#match_length' do
    subject { object.match_length(other) }

    let(:input) { instance_method }

    context 'when other is an equivalent expression' do
      let(:other) { parse_expression(object.syntax) }

      it { is_expected.to be(object.syntax.length) }
    end

    context 'when other is an unequivalent expression' do
      let(:other) { parse_expression('Foo*') }

      it { is_expected.to be(0) }
    end
  end

  describe '#matcher' do
    subject { object.matcher }

    context 'with an instance method' do
      let(:input) { instance_method }

      it 'returns correct matcher' do
        expect(subject.call(env).map(&:expression)).to eql([object])
      end
    end

    context 'with a singleton method' do
      let(:input) { singleton_method }

      it 'returns correct matcher' do
        expect(subject.call(env).map(&:expression)).to eql([object])
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutest-0.0.10 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.9 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.8 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.7 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.6 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.5 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.4 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.3 spec/unit/mutest/expression/method_spec.rb
mutest-0.0.2 spec/unit/mutest/expression/method_spec.rb