Sha256: f1a3bf61e2f039c2ff0f11406f810cf20d52d2ef287c4b23e3089e990108ef43

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

RSpec.describe Mutant::Expression::Methods do

  let(:object)            { described_class.parse(input) }
  let(:env)               { Fixtures::TEST_ENV           }
  let(:instance_methods)  { 'TestApp::Literal#'          }
  let(:singleton_methods) { 'TestApp::Literal.'          }

  describe '#match_length' do
    let(:input) { instance_methods }

    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_methods }

      it { should eql(Mutant::Matcher::Methods::Instance.new(env, TestApp::Literal)) }
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutant-0.6.3 spec/unit/mutant/expression/methods_spec.rb
mutant-0.6.2 spec/unit/mutant/expression/methods_spec.rb
mutant-0.6.0 spec/unit/mutant/expression/methods_spec.rb