Sha256: 1821e11998b416f11553d5467ef4cb7fd7969ca4875627569563083db5c9939a

Contents?: true

Size: 1.67 KB

Versions: 9

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton, '#spec_files' do

  subject { object.spec_files }

  let(:object)           { described_class.new(mutation_subject)                                             }
  let(:mutation_subject) { mock('Subject', :name => method_name, :public? => is_public, :context => context) }
  let(:method_name)      { :bar                                                                              }
  let(:files)            { 'Files'.freeze                                                                    }
  let(:context)          { mock('Context', :name => 'Foo')                                                   }

  this_example_group = 'Mutant::Strategy::Rspec::DM2::Lookup::Method::Singleton#spec_files'

  shared_examples_for this_example_group do
    it_should_behave_like 'an idempotent method'

    before do
      if is_public
        Mutant::Strategy::MethodExpansion.should_receive(:run).with(method_name).and_return(:expanded_name)
      end
      Dir.should_receive(:glob).with(expected_glob_expression).and_return(files)
    end

    it { should be(files) }
    it { should be_frozen }
  end

  context 'with public method' do
    let(:is_public)                { true                                                }
    let(:expected_glob_expression) { 'spec/unit/foo/class_methods/expanded_name_spec.rb' }

    it_should_behave_like this_example_group
  end

  context 'with nonpublic method' do
    let(:is_public)                { false                                   }
    let(:expected_glob_expression) { 'spec/unit/foo/class_methods/*_spec.rb' }

    it_should_behave_like this_example_group
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutant-0.3.0.beta13 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta12 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta11 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta10 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta9 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta8 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta7 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta6 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb
mutant-0.3.0.beta5 spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb