Sha256: f37c16200a642db3377565973ba523c83a009f35ce8d1e5385e31336119e30ec

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.16 spec/shared/method_matcher_behavior.rb
mutant-0.8.15 spec/shared/method_matcher_behavior.rb
mutant-0.8.14 spec/shared/method_matcher_behavior.rb
mutant-0.8.13 spec/shared/method_matcher_behavior.rb
mutant-0.8.12 spec/shared/method_matcher_behavior.rb
mutant-0.8.11 spec/shared/method_matcher_behavior.rb
mutant-0.8.10 spec/shared/method_matcher_behavior.rb
mutant-0.8.9 spec/shared/method_matcher_behavior.rb