Class: Thoreau::Case::CaseBuilder
- Inherits:
-
Object
- Object
- Thoreau::Case::CaseBuilder
- Includes:
- Logging
- Defined in:
- lib/thoreau/case/case_builder.rb
Overview
Build test cases.
It is responsible for:
-
building an list of Test::Case objects based on the groups provided.
-
expanding input specs in the groups into multiple cases
-
skipping unfocused tests, if any are focused
-
returning a count of those skipped
Instance Method Summary collapse
- #any_focused? ⇒ Boolean
- #build_test_cases! ⇒ Object
-
#initialize(test_clan:) ⇒ CaseBuilder
constructor
A new instance of CaseBuilder.
- #skipped_count ⇒ Object
Methods included from Logging
Constructor Details
#initialize(test_clan:) ⇒ CaseBuilder
Returns a new instance of CaseBuilder.
15 16 17 18 19 20 |
# File 'lib/thoreau/case/case_builder.rb', line 15 def initialize(test_clan:) logger.debug("CaseBuilder.new #{test_clan.name} #{test_clan.test_families.size} families") @test_families = test_clan.test_families @action_block = test_clan.action_block @appendix = test_clan.appendix end |
Instance Method Details
#any_focused? ⇒ Boolean
22 23 24 |
# File 'lib/thoreau/case/case_builder.rb', line 22 def any_focused? @test_families.count(&:focused?) > 0 end |
#build_test_cases! ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/thoreau/case/case_builder.rb', line 31 def build_test_cases! logger.debug " build_test_cases! (#{@test_families.size} families)" @test_families .select { |fam| any_focused? && fam.focused? || !any_focused? } .flat_map { |fam| build_family_cases fam } end |
#skipped_count ⇒ Object
26 27 28 29 |
# File 'lib/thoreau/case/case_builder.rb', line 26 def skipped_count return 0 unless any_focused? @test_families.count - @test_families.count(&:focused?) end |