Class: Mutiny::Integration::RSpec::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/mutiny/integration/rspec/context.rb

Overview

This code originally based on Markus Schirp’s implementation of Mutant::Integration::Rspec

https://github.com/mbj/mutant/blob/master/lib/mutant/integration/rspec.rb

Constant Summary collapse

DEFAULT_CLI_OPTIONS =
%w(spec)
FAIL_FAST_CLI_OPTION =
%w(--fail-fast)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Context

Returns a new instance of Context.



15
16
17
18
19
20
21
22
# File 'lib/mutiny/integration/rspec/context.rb', line 15

def initialize(options = {})
  @options = options
  @output = StringIO.new
  @world  = ::RSpec.world
  @configuration = ::RSpec.configuration
  @runner = ::RSpec::Core::Runner.new(::RSpec::Core::ConfigurationOptions.new(cli_options))
  @runner.setup($stderr, @output)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



13
14
15
# File 'lib/mutiny/integration/rspec/context.rb', line 13

def configuration
  @configuration
end

#outputObject (readonly)

Returns the value of attribute output.



13
14
15
# File 'lib/mutiny/integration/rspec/context.rb', line 13

def output
  @output
end

#runnerObject (readonly)

Returns the value of attribute runner.



13
14
15
# File 'lib/mutiny/integration/rspec/context.rb', line 13

def runner
  @runner
end

#worldObject (readonly)

Returns the value of attribute world.



13
14
15
# File 'lib/mutiny/integration/rspec/context.rb', line 13

def world
  @world
end

Instance Method Details

#cli_optionsObject



24
25
26
27
28
29
30
# File 'lib/mutiny/integration/rspec/context.rb', line 24

def cli_options
  if @options.fetch(:fail_fast, false)
    DEFAULT_CLI_OPTIONS + FAIL_FAST_CLI_OPTION
  else
    DEFAULT_CLI_OPTIONS
  end
end