Sha256: bfbcf85160d8ad23cb0f7c40f5816971acf9929de2a7a1682a94f36306f8db39

Contents?: true

Size: 1.13 KB

Versions: 36

Compression:

Stored size: 1.13 KB

Contents

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

36 entries across 18 versions & 1 rubygems

Version Path
mutant-0.2.20 spec/shared/method_match_behavior.rb
mutant-0.2.20 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.17 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.17 spec/shared/method_match_behavior.rb
mutant-0.2.16 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.16 spec/shared/method_match_behavior.rb
mutant-0.2.15 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.15 spec/shared/method_match_behavior.rb
mutant-0.2.14 spec/shared/method_match_behavior.rb
mutant-0.2.14 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.13 spec/shared/method_match_behavior.rb
mutant-0.2.13 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.12 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.12 spec/shared/method_match_behavior.rb
mutant-0.2.11 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.11 spec/shared/method_match_behavior.rb
mutant-0.2.9 test_app/spec/shared/method_match_behavior.rb
mutant-0.2.9 spec/shared/method_match_behavior.rb
mutant-0.2.8 spec/shared/method_match_behavior.rb
mutant-0.2.8 test_app/spec/shared/method_match_behavior.rb