class Goggles::Iteration

Executes the block passed to ‘Goggles.each` with every configured combination of browser

and browser size.

@see Goggles.each

Attributes

browser[R]
browser_name[R]
config[R]
size[R]

Public Class Methods

new(driver, width, config) { |browser| ... } click to toggle source

Creates a script iteration instance, building yielded browser object from the

given arguments. Closes the browser instance after yielding to the block.

@param driver [String, Symbol] browser name @param width [Fixnum] browser width @param config [Goggles::Configuration] global configuration @yield [Watir::Browser] browser object

# File lib/goggles/iteration.rb, line 42
def initialize driver, width, config, &block
  @browser_name = driver
  @config       = config
  @size         = width
  build_browser
  yield browser
  browser.close
end

Private Instance Methods

build_browser() click to toggle source

@api private

# File lib/goggles/iteration.rb, line 56
def build_browser
  @browser = Watir::Browser.new(browser_name).tap do |engine|
    engine.goggles   = config
    engine.iteration = self
    engine.driver.manage.window.resize_to size, 768
  end
end