Sha256: 2ba4fc67885f127994e71f0f983ad706651716a20e756c19bdf73c8fbe24ab00

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Mutant::CLI::Classifier, '.build' do
  subject { described_class.build(input) }

  this_spec = 'Mutant::CLI::Classifier.build'

  shared_examples_for this_spec do
    it 'shoud return expected instance' do
      should eql(expected_class.new(expected_class::REGEXP.match(input)))
    end
  end

  context 'with explicit toplevel scope' do

    let(:input)           { '::TestApp::Literal#string' }
    let(:expected_class)  { Mutant::CLI::Classifier::Method }

    it_should_behave_like this_spec
  end

  context 'with instance method notation' do

    let(:input)           { 'TestApp::Literal#string' }
    let(:expected_class)  { Mutant::CLI::Classifier::Method }

    it_should_behave_like this_spec
  end

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

    it_should_behave_like this_spec
  end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutant-0.3.0.beta4 spec/unit/mutant/cli/classifier/class_methods/build_spec.rb
mutant-0.3.0.beta3 spec/unit/mutant/cli/classifier/class_methods/build_spec.rb
mutant-0.3.0.beta2 spec/unit/mutant/cli/classifier/class_methods/build_spec.rb