Class: Knapsack::Adapters::CucumberAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- Knapsack::Adapters::CucumberAdapter
- Defined in:
- lib/knapsack/adapters/cucumber_adapter.rb
Constant Summary collapse
- TEST_DIR_PATTERN =
'features/**{,/*/**}/*.feature'
- REPORT_PATH =
'knapsack_cucumber_report.json'
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseAdapter
Class Method Details
.test_path(object) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/knapsack/adapters/cucumber_adapter.rb', line 36 def self.test_path(object) if ::Cucumber::VERSION.to_i >= 2 test_case = object test_case.location.file else if object.respond_to?(:scenario_outline) if object.scenario_outline.respond_to?(:feature) # Cucumber < 1.3 object.scenario_outline.feature.file else # Cucumber >= 1.3 object.scenario_outline.file end else if object.respond_to?(:feature) # Cucumber < 1.3 object.feature.file else # Cucumber >= 1.3 object.file end end end end |
Instance Method Details
#bind_report_generator ⇒ Object
20 21 22 23 24 25 |
# File 'lib/knapsack/adapters/cucumber_adapter.rb', line 20 def bind_report_generator ::Kernel.at_exit do Knapsack.report.save Knapsack.logger.info(Presenter.report_details) end end |
#bind_time_offset_warning ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/knapsack/adapters/cucumber_adapter.rb', line 27 def bind_time_offset_warning ::Kernel.at_exit do Knapsack.logger.log( Presenter.time_offset_log_level, Presenter.time_offset_warning ) end end |
#bind_time_tracker ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/knapsack/adapters/cucumber_adapter.rb', line 7 def bind_time_tracker Around do |object, block| Knapsack.tracker.test_path = CucumberAdapter.test_path(object) Knapsack.tracker.start_timer block.call Knapsack.tracker.stop_timer end ::Kernel.at_exit do Knapsack.logger.info(Presenter.global_time) end end |