Sha256: 5762132d7b26e526e80e9881c960c28cd7b329148d7b3fb39b0574f4b148c72c

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

# encoding: utf-8

module Mutant
  class Strategy
    # Rspec killer strategy
    class Rspec < self
      include Concord.new(:level)

      KILLER = Killer::Forking.new(Killer::Rspec)

      # Setup rspec strategy
      #
      # @return [self]
      #
      # @api private
      #
      def setup
        output = StringIO.new
        configuration.error_stream = output
        configuration.output_stream = output
        options.configure(configuration)
        configuration.load_spec_files
        self
      end
      memoize :setup

      # Return configuration
      #
      # @return [RSpec::Core::Configuration]
      #
      # @api private
      #
      def configuration
        RSpec::Core::Configuration.new
      end
      memoize :configuration, freezer: :noop

      # Return example groups
      #
      # @return [Enumerable<RSpec::Core::ExampleGroup>]
      #
      # @api private
      #
      def example_groups
        world.example_groups
      end

    private

      # Return world
      #
      # @return [RSpec::Core::World]
      #
      # @api private
      #
      def world
        RSpec.world
      end
      memoize :world, freezer: :noop

      # Return options
      #
      # @return [RSpec::Core::ConfigurationOptions]
      #
      # @api private
      #
      def options
        options = RSpec::Core::ConfigurationOptions.new(%w(--fail-fast spec))
        options.parse_options
        options
      end
      memoize :options, freezer: :noop

    end # Rspec
  end # Strategy
end # Mutant

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mutant-0.3.6 lib/mutant/strategy/rspec.rb
mutant-0.3.5 lib/mutant/strategy/rspec.rb
mutant-0.3.4 lib/mutant/strategy/rspec.rb
mutant-0.3.3 lib/mutant/strategy/rspec.rb
mutant-0.3.2 lib/mutant/strategy/rspec.rb
mutant-0.3.1 lib/mutant/strategy/rspec.rb
mutant-0.3.0 lib/mutant/strategy/rspec.rb
mutant-0.3.0.rc5 lib/mutant/strategy/rspec.rb
mutant-0.3.0.rc4 lib/mutant/strategy/rspec.rb
mutant-0.3.0.rc3 lib/mutant/strategy/rspec.rb
mutant-0.3.0.rc2 lib/mutant/strategy/rspec.rb