Sha256: d0750dcd5122e1352ad697883709af8b2ae37e6ccb7dc05d1bbe04b07c5cec28

Contents?: true

Size: 986 Bytes

Versions: 5

Compression:

Stored size: 986 Bytes

Contents

module Mutant
  class Killer
    # Runner for rspec tests
    class Rspec < self
      TYPE = 'rspec'.freeze

    private

      # Initialize rspec runner
      #
      # @return [undefined]
      #
      # @api private
      #
      def initialize(*)
        @error_stream, @output_stream = StringIO.new, StringIO.new
        super
      end

      # Run rspec test
      #
      # @return [true]
      #   returns true when test is NOT successful and the mutant was killed
      #
      # @return [false]
      #   returns false otherwise
      #
      # @api private
      #
      def run
        mutation.insert
        !::RSpec::Core::Runner.run(command_line_arguments, @error_stream, @output_stream).zero?
      end
      memoize :run

      # Return command line arguments
      #
      # @return [Array]
      #
      # @api private
      #
      def command_line_arguments
        %W(
          --fail-fast
        ) + strategy.spec_files(mutation)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.2.4 lib/mutant/killer/rspec.rb
mutant-0.2.3 lib/mutant/killer/rspec.rb
mutant-0.2.2 lib/mutant/killer/rspec.rb
mutant-0.2.1 lib/mutant/killer/rspec.rb
mutant-0.2.0 lib/mutant/killer/rspec.rb