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.
8 9 10 |
# File 'lib/cornucopia/util/test_helper.rb', line 8 def spinach_reported_error @spinach_reported_error end |
#spinach_running_scenario ⇒ Object
Returns the value of attribute spinach_running_scenario.
8 9 10 |
# File 'lib/cornucopia/util/test_helper.rb', line 8 def spinach_running_scenario @spinach_running_scenario end |
Instance Method Details
#cucumber_name(scenario) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cornucopia/util/test_helper.rb', line 10 def cucumber_name(scenario) report_name = "Unknown" if scenario.respond_to?(:feature) report_name = "#{scenario.feature.title}:#{scenario.title}" elsif scenario.respond_to?(:line) report_name = "Line - #{scenario.line}" end report_name end |
#record_test(start_end, test_name) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/cornucopia/util/test_helper.rb', line 44 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
33 34 35 |
# File 'lib/cornucopia/util/test_helper.rb', line 33 def record_test_end(test_name) record_test("End", test_name) end |
#record_test_start(test_name) ⇒ Object
29 30 31 |
# File 'lib/cornucopia/util/test_helper.rb', line 29 def record_test_start(test_name) record_test("Start", test_name) end |
#rspec_name(example) ⇒ Object
25 26 27 |
# File 'lib/cornucopia/util/test_helper.rb', line 25 def rspec_name(example) example.full_description end |
#spinach_name(scenario_data) ⇒ Object
21 22 23 |
# File 'lib/cornucopia/util/test_helper.rb', line 21 def spinach_name(scenario_data) "#{scenario_data.feature.name} : #{scenario_data.name}" end |
#test_message(start_end, test_name) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/cornucopia/util/test_helper.rb', line 37 def (start_end, test_name) Cornucopia::Util::Configuration.record_test_start_and_end_format % { start_end: start_end, test_name: test_name } end |