Class: Cornucopia::Util::TestHelper
- Inherits:
-
Object
- Object
- Cornucopia::Util::TestHelper
- Includes:
- Singleton
- Defined in:
- lib/cornucopia/util/test_helper.rb
Instance Attribute Summary collapse
-
#spinach_reported_error ⇒ Object
Returns the value of attribute spinach_reported_error.
-
#spinach_running_scenario ⇒ Object
Returns the value of attribute spinach_running_scenario.
Instance Method Summary collapse
- #cucumber_name(scenario) ⇒ Object
- #record_test(start_end, test_name) ⇒ Object
- #record_test_end(test_name) ⇒ Object
- #record_test_start(test_name) ⇒ Object
- #rspec_name(example) ⇒ Object
- #spinach_name(scenario_data) ⇒ Object
- #test_message(start_end, test_name) ⇒ Object
Instance Attribute Details
#spinach_reported_error ⇒ Object
Returns the value of attribute spinach_reported_error.
10 11 12 |
# File 'lib/cornucopia/util/test_helper.rb', line 10 def spinach_reported_error @spinach_reported_error end |
#spinach_running_scenario ⇒ Object
Returns the value of attribute spinach_running_scenario.
10 11 12 |
# File 'lib/cornucopia/util/test_helper.rb', line 10 def spinach_running_scenario @spinach_running_scenario end |
Instance Method Details
#cucumber_name(scenario) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cornucopia/util/test_helper.rb', line 12 def cucumber_name(scenario) report_name = "Unknown" if scenario.respond_to?(:feature) if scenario.feature.respond_to?(:name) report_name = "#{scenario.feature.name}:#{scenario.name}" else report_name = "#{scenario.feature.title}:#{scenario.title}" end elsif scenario.respond_to?(:line) report_name = "Line - #{scenario.line}" end report_name end |
#record_test(start_end, test_name) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/cornucopia/util/test_helper.rb', line 50 def record_test(start_end, test_name) if Cornucopia::Util::Configuration.record_test_start_and_end_in_log if Object.const_defined?("Rails") Rails.logger.error((start_end, test_name)) end end end |
#record_test_end(test_name) ⇒ Object
39 40 41 |
# File 'lib/cornucopia/util/test_helper.rb', line 39 def record_test_end(test_name) record_test("End", test_name) end |
#record_test_start(test_name) ⇒ Object
35 36 37 |
# File 'lib/cornucopia/util/test_helper.rb', line 35 def record_test_start(test_name) record_test("Start", test_name) end |
#rspec_name(example) ⇒ Object
31 32 33 |
# File 'lib/cornucopia/util/test_helper.rb', line 31 def rspec_name(example) example.full_description end |
#spinach_name(scenario_data) ⇒ Object
27 28 29 |
# File 'lib/cornucopia/util/test_helper.rb', line 27 def spinach_name(scenario_data) "#{scenario_data.feature.name} : #{scenario_data.name}" end |
#test_message(start_end, test_name) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/cornucopia/util/test_helper.rb', line 43 def (start_end, test_name) Cornucopia::Util::Configuration.record_test_start_and_end_format % { start_end: start_end, test_name: test_name } end |