Sha256: 143186ddcdfbdc2e41e5de89d0a102953e71b373c123b72de4585c39cbba01e6

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

RSpec.describe Mutant::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
    let(:input) { instance_method }

    subject { object.match_length(other) }

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

      it { should be(object.syntax.length) }
    end

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

      it { should 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

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.24 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.23 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.22 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.21 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.20 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.19 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.18 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.17 spec/unit/mutant/expression/method_spec.rb