Sha256: d3dbf79403ed5f477f8d40ed8034310ca1960a6697760259f45fd6059a31a5df

Contents?: true

Size: 1.14 KB

Versions: 27

Compression:

Stored size: 1.14 KB

Contents

# encoding: utf-8

shared_examples_for 'a method match' do
  subject { Mutant::Matcher::Method.parse(pattern).to_a }

  let(:values) { defaults.merge(expectation) }

  let(:method_name)       { values.fetch(:method_name)  }
  let(:method_line)       { values.fetch(:method_line)  }
  let(:method_arity)      { values.fetch(:method_arity) }
  let(:scope)             { values.fetch(:scope)        }
  let(:node_class)        { values.fetch(:node_class)   }
  let(:node)              { mutation_subject.node       }
  let(:context)           { mutation_subject.context    }
  let(:mutation_subject)  { subject.first               }

  it 'should return one subject' do
    subject.size.should be(1)
  end

  it 'should have correct method name' do
    name(node).should eql(method_name)
  end

  it 'should have correct line number' do
    node.line.should eql(method_line)
  end

  it 'should have correct arity' do
    arguments(node).required.length.should eql(method_arity)
  end

  it 'should have correct scope in context' do
    context.send(:scope).should eql(scope)
  end

  it 'should have the correct node class' do
    node.should be_a(node_class)
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
mutant-0.5.13 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.12 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.11 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.10 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.9 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.8 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.7 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.6 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.5 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.4 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.3 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.2 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.1 test_app/spec/shared/method_match_behavior.rb
mutant-0.5.0 test_app/spec/shared/method_match_behavior.rb
mutant-0.3.6 test_app/spec/shared/method_match_behavior.rb
mutant-0.3.5 test_app/spec/shared/method_match_behavior.rb
mutant-0.3.4 test_app/spec/shared/method_match_behavior.rb
mutant-0.3.3 test_app/spec/shared/method_match_behavior.rb
mutant-0.3.2 test_app/spec/shared/method_match_behavior.rb
mutant-0.3.1 test_app/spec/shared/method_match_behavior.rb