Sha256: c1d01517226e35eb2fa348791ae0c96b5eed82cde75957df26030bab78e3e9c2

Contents?: true

Size: 1.55 KB

Versions: 17

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe Mutant::Matcher::Method::Classifier, '.run' do
  subject { described_class.run(input) }

  shared_examples_for 'Mutant::Matcher::Method::Classifier.run' do
    before do
      expected_class.stub(:new => response)
    end

    let(:response) { :Response }

    it { should be(response) }

    it 'should initialize method filter with correct arguments' do
      expected_class.should_receive(:new).with(TestApp::Literal, expected_method).and_return(response)
      subject
    end
  end

  context 'with explicit toplevel scope' do
    let(:input)           { '::TestApp::Literal#string' }
    let(:expected_class)  { Mutant::Matcher::Method::Instance }
    let(:expected_method) { TestApp::Literal.instance_method(:string) }

    it_should_behave_like 'Mutant::Matcher::Method::Classifier.run'
  end

  context 'with instance method notation' do
    let(:input)           { 'TestApp::Literal#string' }
    let(:expected_method) { TestApp::Literal.instance_method(:string) }
    let(:expected_class)  { Mutant::Matcher::Method::Instance }

    it_should_behave_like 'Mutant::Matcher::Method::Classifier.run'
  end

  context 'with singleton method notation' do
    let(:input)           { 'TestApp::Literal.string' }
    let(:expected_method) { TestApp::Literal.method(:string) }
    let(:expected_class)  { Mutant::Matcher::Method::Singleton }

    it_should_behave_like 'Mutant::Matcher::Method::Classifier.run'
  end

  context 'with invalid notation' do
    let(:input) { 'Foo' }

    it 'should return nil' do
      should be(nil)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mutant-0.2.20 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.17 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.16 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.15 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.14 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.13 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.12 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.11 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.9 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.8 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.7 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.6 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.5 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.4 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.3 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.2 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb
mutant-0.2.1 spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb