Sha256: 8c3e352b94146c677eb484d83e75c2a0e9e3416ef0e6f0accc6ec5e801635863

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

require 'rspec'
require 'capybara/rspec'
require_relative '../boot'

RSpec.configure do |config|
  log.settings_as_formatted_text

  DataStorage.store('sauce', :start_time, Time.now.utc)
  DataStorage.store('sauce', :status, true)

  config.include CapybaraSettings
  config.include Capybara::RSpecMatchers
  config.include DataGenerator

  config.mock_with(:rspec){|c| c.syntax = :expect}
  config.expect_with(:rspec) { |c| c.syntax = :expect }

  config.color_enabled = true
  config.treat_symbols_as_metadata_keys_with_true_values = true

  config.before(:all) do
    if sauce_driver?
      suite_name = "#{(ENV['RAKE_TASK'] || 'CUSTOM').sub("rspec:", '').upcase} #{settings.sl_browser_name.upcase}"
      Capybara.drivers[:sauce][].options[:desired_capabilities][:name] = suite_name
    end
  end

  config.before(:each) do
    log.print_scenario_name(example.description.empty? ? example.metadata[:full_description] : example.description)
    @session_start = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
  end

  config.after(:each) do
    Gen.delete_all_mailboxes
    DataStorage.clear_ns("user")
    if sauce_driver?
      session_end = duration(Time.now.utc - DataStorage.extract('sauce', :start_time))
      log.info "SAUCE VIDEO #@session_start - #{session_end} URL: #{sauce_resource_path('video.flv')}"
    end  
  end

  config.after(:suite) do
    if sauce_driver?
      report_failures_count = config.reporter.instance_variable_get(:@failure_count)
      DataStorage.store('sauce', :status, report_failures_count.zero?) 
    end
  end

  at_exit do
    if sauce_driver?
      log.info "SAUCE SERVER LOG URL: #{CapybaraSettings.sauce_resource_path('selenium-server.log')}"
      CapybaraSettings.update_sauce_job_status(passed: DataStorage.extract('sauce', :status))
    end
    Gen.delete_all_mailboxes
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
howitzer-1.0.1 generators/rspec/templates/spec_helper.rb