Class: Mutant::Rspec::Strategy
- Inherits:
-
Strategy
- Object
- Strategy
- Mutant::Rspec::Strategy
- Defined in:
- lib/mutant/rspec/strategy.rb
Overview
Rspec killer strategy
Constant Summary collapse
- RSPEC_2_VERSION_PREFIX =
'2.'.freeze
Instance Method Summary collapse
-
#all_tests ⇒ Enumerable<Test>
private
Return all available tests.
-
#rspec2? ⇒ Boolean
private
Test for rspec2.
-
#run(test) ⇒ Object
private
Return report for test.
-
#setup ⇒ self
private
Setup rspec strategy.
Instance Method Details
#all_tests ⇒ Enumerable<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
61 62 63 64 65 66 67 68 69 |
# File 'lib/mutant/rspec/strategy.rb', line 61 def all_tests example_groups .flat_map(&:descendants) .map do |example_group| Test.new(self, example_group) end.select do |test| test.identification.split(' ', 2).first.eql?(test.identification) end end |
#rspec2? ⇒ Boolean
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.
Test for rspec2
30 31 32 |
# File 'lib/mutant/rspec/strategy.rb', line 30 def rspec2? RSpec::Core::Version::STRING.start_with?(RSPEC_2_VERSION_PREFIX) 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
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mutant/rspec/strategy.rb', line 40 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 |
#setup ⇒ self
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
17 18 19 20 21 |
# File 'lib/mutant/rspec/strategy.rb', line 17 def setup .configure(configuration) configuration.load_spec_files self end |