Sha256: bbbca089f31f98300b3ef38e708526f72d58a0980c55814e0a5b82719c890f77

Contents?: true

Size: 1002 Bytes

Versions: 13

Compression:

Stored size: 1002 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, strategy.error_stream, strategy.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

13 entries across 13 versions & 1 rubygems

Version Path
mutant-0.2.20 lib/mutant/killer/rspec.rb
mutant-0.2.17 lib/mutant/killer/rspec.rb
mutant-0.2.16 lib/mutant/killer/rspec.rb
mutant-0.2.15 lib/mutant/killer/rspec.rb
mutant-0.2.14 lib/mutant/killer/rspec.rb
mutant-0.2.13 lib/mutant/killer/rspec.rb
mutant-0.2.12 lib/mutant/killer/rspec.rb
mutant-0.2.11 lib/mutant/killer/rspec.rb
mutant-0.2.9 lib/mutant/killer/rspec.rb
mutant-0.2.8 lib/mutant/killer/rspec.rb
mutant-0.2.7 lib/mutant/killer/rspec.rb
mutant-0.2.6 lib/mutant/killer/rspec.rb
mutant-0.2.5 lib/mutant/killer/rspec.rb