Sha256: 382aaffcddd5e0a10d79029022444e4893cd9a686285c6ca1ed11c61bb8795d2

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

# encoding: UTF-8
require 'rspec'
require 'simulacrum/driver'
require 'simulacrum/methods'
require 'simulacrum/matchers'

module Simulacrum
  # Base Runner class for running RSpec in parallel.
  class Runner
    attr_reader :exit_code

    def initialize
      configure_driver
      configure_rspec
    end

    def run
      @exit_code = run_rspec
    end

    private

    def configure_driver
      Simulacrum::Driver.use
    end

    def run_rspec
      RSpec::Core::Runner.run(test_files)
    end

    def test_files
      Simulacrum.runner_options.files
    end

    def configure_rspec
      RSpec.configuration.include Simulacrum::Matchers
      RSpec.configuration.extend Simulacrum::Methods
      RSpec.configuration.color = Simulacrum.runner_options.color
      RSpec.configuration.tty = true
      RSpec.configuration.pattern = '**/*_spec.rb'
      RSpec.configuration.profile_examples = false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simulacrum-0.3.2 lib/simulacrum/runner.rb
simulacrum-0.3.1 lib/simulacrum/runner.rb
simulacrum-0.3.0 lib/simulacrum/runner.rb