Sha256: 9caf59969797c005ffbbc9c79a2e60c745f1f2e36024499e796a66f3584ddbab

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

RSpec.describe Mutant::Expression::Method do

  let(:object)           { described_class.parse(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) { described_class.parse(object.syntax) }

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

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

      it { should be(0) }
    end
  end

  describe '#matcher' do
    subject { object.matcher(env) }

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

      it 'returns correct matcher' do
        should eql(Mutant::Matcher::Method::Instance.new(
          env,
          TestApp::Literal, TestApp::Literal.instance_method(:string)
        ))
      end
    end

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

      it { should eql(Mutant::Matcher::Method::Singleton.new(env, TestApp::Literal, TestApp::Literal.method(:string))) }
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mutant-0.7.9 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.8 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.7 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.6 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.5 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.4 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.3 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.2 spec/unit/mutant/expression/method_spec.rb
mutant-0.7.1 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.7 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.6 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.5 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.4 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.3 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.2 spec/unit/mutant/expression/method_spec.rb
mutant-0.6.0 spec/unit/mutant/expression/method_spec.rb