Cleanup rspec runner and extract unused code

This commit is contained in:
Markus Schirp 2012-11-24 17:06:33 +01:00
parent 9d32ddc44f
commit 70060caf5d
3 changed files with 26 additions and 30 deletions

View file

@ -4,26 +4,6 @@ module Mutant
class Rspec < self
TYPE = 'rspec'.freeze
# Run block in clean rspec environment
#
# @return [Object]
# returns the value of block
#
# @api private
#
def self.nest
original_world, original_configuration =
::RSpec.instance_variable_get(:@world),
::RSpec.instance_variable_get(:@configuration)
::RSpec.reset
yield
ensure
::RSpec.instance_variable_set(:@world, original_world)
::RSpec.instance_variable_set(:@configuration, original_configuration)
end
private
# Initialize rspec runner
@ -54,8 +34,6 @@ module Mutant
# Run rspec with some wired compat stuff
#
# FIXME: This extra stuff needs to be configurable per project
#
# @return [Fixnum]
# returns the exit status from rspec runner
#

View file

@ -1,15 +1,12 @@
require 'spec_helper'
describe Mutant::Killer::Rspec, '.run' do
describe Mutant::Killer::Rspec, '.new' do
before do
pending
end
subject { object.new(strategy, mutation) }
subject { object.run(mutation) }
let(:context) { mock('Context') }
let(:mutation) { mock('Mutation') }
let(:strategy) { mock('Strategy', :filename_pattern => 'foo') }
let(:context) { mock('Context') }
let(:mutation) { mock('Mutation') }
let(:object) { described_class }

21
stuff.rb Normal file
View file

@ -0,0 +1,21 @@
# Run block in clean rspec environment
#
# @return [Object]
# returns the value of block
#
# @api private
#
def self.nest
original_world, original_configuration =
::RSpec.instance_variable_get(:@world),
::RSpec.instance_variable_get(:@configuration)
::RSpec.reset
yield
ensure
::RSpec.instance_variable_set(:@world, original_world)
::RSpec.instance_variable_set(:@configuration, original_configuration)
end