free_mutant/spec/shared/method_matcher_behavior.rb
Markus Schirp 3cea008fcd Fix Matcher env arguments
* Due historical reasons Env#warn also existed and in specs we actually
  passed an Env object where runtime passes Env::Boostrap objects.
* Fix documentation for runtime type
* Fix specs to pass in the runtime type
* Remove now unused Env#warn
2015-11-16 01:07:31 +00:00

45 lines
1.1 KiB
Ruby

RSpec.shared_examples_for 'a method matcher' do
let(:node) { mutation_subject.node }
let(:context) { mutation_subject.context }
let(:mutation_subject) { subject.first }
it 'returns one subject' do
expect(subject.size).to be(1)
end
it 'has expected method name' do
expect(name).to eql(method_name)
end
it 'has expected line number' do
expect(node.location.expression.line).to eql(method_line)
end
it 'has expected arity' do
expect(arguments.children.length).to eql(method_arity)
end
it 'has expected scope in context' do
expect(context.scope).to eql(scope)
end
it 'has source path in context' do
expect(context.source_path).to eql(source_path)
end
it 'has the correct node type' do
expect(node.type).to be(type)
end
end
RSpec.shared_examples_for 'skipped candidate' do
before do
expected_warnings.each do |warning|
expect(env).to receive(:warn).with(warning).and_return(env)
end
end
it 'does not emit matcher' do
expect(subject).to eql([])
end
end