Class: SpecHelperTemplate
- Defined in:
- lib/generators/templates/helpers/spec_helper_template.rb
Instance Method Summary collapse
Methods inherited from Template
Constructor Details
This class inherits a constructor from Template
Instance Method Details
#body ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/templates/helpers/spec_helper_template.rb', line 4 def body " require 'active_support/all'\n require 'rspec'\n require_relative 'allure_helper'\n require_relative '\#{@automation == 'watir' ? 'browser_helper' : 'driver_helper'}'\n\n module Raider\n module SpecHelper\n\n AllureHelper.configure\n\n RSpec.configure do |config|\n config.formatter = AllureHelper.formatter\n config.before(:each) do\n \#{@automation == 'watir' ? 'BrowserHelper.new_browser' : 'DriverHelper.new_driver'}\n end\n\n config.after(:each) do\n \#{@automation == 'watir' ? 'browser = BrowserHelper.browser' : 'driver = DriverHelper.driver'}\n example_name = self.class.descendant_filtered_examples.first.description\n status = self.class.descendant_filtered_examples.first.execution_result.status\n \#{@automation == 'watir' ? 'browser' : 'driver'}.save_screenshot(\"allure-results/screenshots/#\\{example_name}.png\") if status == :failed\n AllureHelper.add_screenshot example_name if status == :failed\n \#{@automation == 'watir' ? 'browser.quit' : 'driver.quit'}\n end\n end\n end\n end\n EOF\nend\n" |