Sha256: 1afb488cdad3b0c47965012dd4b4ab19fe7236e636b8830e0346596e13670a00

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

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

9 entries across 9 versions & 1 rubygems

Version Path
mutant-0.8.16 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.15 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.14 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.13 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.12 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.11 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.10 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.9 spec/unit/mutant/expression/method_spec.rb
mutant-0.8.8 spec/unit/mutant/expression/method_spec.rb