free_mutant/spec/shared/method_matcher_behavior.rb
Dan Kubb 7293386c26 Add magic encoding header to all ruby files
* rubocop still warns about this on ruby 1.9.3, so it was fixed so
  it produces less output on travis.
2013-07-28 16:03:06 -07:00

36 lines
842 B
Ruby

# encoding: utf-8
shared_examples_for 'a method matcher' do
before { subject }
let(:node) { mutation_subject.node }
let(:context) { mutation_subject.context }
let(:mutation_subject) { yields.first }
it 'should return one subject' do
yields.size.should be(1)
end
it_should_behave_like 'an #each method'
it 'should have correct method name' do
name.should eql(method_name)
end
it 'should have correct line number' do
(node.location.expression.line - base).should eql(method_line)
end
it 'should have correct arity' do
arguments.children.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 type' do
node.type.should be(type)
end
end