Class: Mutant::Rspec::Strategy

Inherits:
Strategy
  • Object
show all
Defined in:
lib/mutant/rspec/strategy.rb

Overview

Rspec killer strategy

Constant Summary collapse

RSPEC_2_VERSION_PREFIX =
'2.'.freeze

Instance Method Summary collapse

Instance Method Details

#all_testsEnumerable<Test>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return all available tests

Returns:

  • (Enumerable<Test>)


53
54
55
56
57
# File 'lib/mutant/rspec/strategy.rb', line 53

def all_tests
  example_groups.map do |example_group|
    Test.new(self, example_group)
  end
end

#run(test) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return report for test

Parameters:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/mutant/rspec/strategy.rb', line 32

def run(test)
  output = StringIO.new
  success = false
  reporter = new_reporter(output)
  reporter.report(1) do
    success = test.example_group.run(reporter)
  end
  output.rewind
  Test::Report.new(
    test:    self,
    output:  output.read,
    success: success
  )
end

#setupself

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Setup rspec strategy

Returns:

  • (self)


19
20
21
22
23
# File 'lib/mutant/rspec/strategy.rb', line 19

def setup
  options.configure(configuration)
  configuration.load_spec_files
  self
end