Sha256: 62f13440225e5d0b8214b2edd803ccf0b4608da97be29c851bf1cc3ab1bb18bd

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

module Kookaburra
  class UIDriver
    module HasBrowser
      Unexpected500 = Class.new(StandardError)

      # This will fail if the options hash does not include a value for the key :browser
      def initialize(options = {})
        super()
        @opts = options
      end

      def browser
        @browser ||= @opts.fetch(:browser)
      end

      def visit(*args)
        browser.visit *args
        no_500_error!
      end

      # Does not wait, so should only be used after failing a check
      # for being in the expected place.
      def no_500_error!
        return true if browser.all(:css, 'head title', :text => 'Internal Server Error').empty?
        sleep 30 if ENV['GIMME_CRAP']
        raise Unexpected500, browser.body
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kookaburra-0.14.4 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.14.3 lib/kookaburra/ui_driver/mixins/has_browser.rb