free_mutant/lib/mutant/killer/rspec.rb
Dan Kubb 59f952d56f Remove rescue from rspec killer
* Based on recent discussions in #68 we think rescuing all
  exceptions like this was probably a mistake.

  If this continues to be a problem we will need to narrow things
  down to a reproducible issue we can report to the RSpec team.

  One possible work-around might be to catch exceptions that occur
  within the specs themselves, and to bubble up everything else.
  However, this does bring up the question of why the specs failed;
  if it was due to a syntax error caused by mutant and unparser,
  then that's probably a bug we need to fix. It could be for some
  other reason, which we would have to isolate and handle
  explicitly, but I think we are all in agreement that this logic is
  too broad.
2013-07-21 23:14:57 -07:00

40 lines
797 B
Ruby

module Mutant
class Killer
# Runner for rspec tests
class Rspec < self
private
# Run rspec test
#
# @return [true]
# when test is NOT successful
#
# @return [false]
# otherwise
#
# @api private
#
def run
mutation.insert
# TODO: replace with real streams from configuration
require 'stringio'
null = StringIO.new
!::RSpec::Core::Runner.run(command_line_arguments, null, null).zero?
end
# Return command line arguments
#
# @return [Array]
#
# @api private
#
def command_line_arguments
%W(
--fail-fast
) + strategy.spec_files(mutation.subject)
end
end # Rspec
end # Killer
end # Mutant