class Cornucopia::Util::TestHelper

Attributes

spinach_reported_error[RW]
spinach_running_scenario[RW]

Public Instance Methods

cucumber_name(scenario) click to toggle source
# 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) click to toggle source
# 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(test_message(start_end, test_name))
    end
  end
end
record_test_end(test_name) click to toggle source
# 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) click to toggle source
# File lib/cornucopia/util/test_helper.rb, line 35
def record_test_start(test_name)
  record_test("Start", test_name)
end
rspec_name(example) click to toggle source
# File lib/cornucopia/util/test_helper.rb, line 31
def rspec_name(example)
  example.full_description
end
spinach_name(scenario_data) click to toggle source
# 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) click to toggle source
# File lib/cornucopia/util/test_helper.rb, line 43
def test_message(start_end, test_name)
  Cornucopia::Util::Configuration.record_test_start_and_end_format % {
      start_end: start_end,
      test_name: test_name
  }
end