free_mutant/lib/mutant/killer/rspec.rb

40 lines
767 B
Ruby
Raw Normal View History

module Mutant
class Killer
# Runner for rspec tests
class Rspec < self
2013-01-15 23:46:05 +01:00
TYPE = 'rspec'.freeze
private
# Run rspec test
#
# @return [true]
# when test is NOT successful and the mutant was killed
#
# @return [false]
# otherwise
#
# @api private
#
def run
mutation.insert
!!::RSpec::Core::Runner.run(command_line_arguments, strategy.error_stream, strategy.output_stream).nonzero?
end
memoize :run
# Return command line arguments
#
# @return [Array]
#
# @api private
#
def command_line_arguments
%W(
--fail-fast
2013-01-13 23:47:00 +01:00
) + strategy.spec_files(mutation.subject)
end
end
end
end