class RainforestRubyRuntime::Drivers::Sauce

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/rainforest_ruby_runtime/drivers/sauce.rb, line 6
def initialize(options)
  @options = options
end

Public Instance Methods

to_rspec(tests) click to toggle source
# File lib/rainforest_ruby_runtime/drivers/sauce.rb, line 10
def to_rspec(tests)
  apply_config

  RSpec.describe 'Rainforest', sauce: true, tests: tests do
    metadata[:tests].each do |test|
      it "[#{test.id}] #{test.title}" do
        test.run
      end
    end
  end
end

Private Instance Methods

apply_config() click to toggle source
# File lib/rainforest_ruby_runtime/drivers/sauce.rb, line 24
def apply_config
  ::Sauce.config do |c|
    c[:browsers] = browsers
    c[:sauce_connect_4_executable] = File.join(
      RainforestRubyRuntime.root,
      RainforestRubyRuntime.sc_executable_path)
    c[:start_local_application] = false
  end
end
browsers() click to toggle source
# File lib/rainforest_ruby_runtime/drivers/sauce.rb, line 34
def browsers
  Array(options[:browsers]).map do |browser|
    {
      chrome: ['Windows 7', 'Chrome', 'latest'],
      firefox: ['Windows 7', 'Firefox', 'latest'],
      ie: ['Windows 7', 'Internet Explorer', 'latest'],
      edge: ['Windows 10', 'microsoftedge', 'latest'],
      safari: ['Mac 10.11', 'Safari', 'latest'],
    }.fetch(browser)
  end
end