Sha256: 49bff041c349dc782972b12264fbf72213442adb3f000cdf8a9b080b63f8458f

Contents?: true

Size: 768 Bytes

Versions: 8

Compression:

Stored size: 768 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 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

8 entries across 8 versions & 1 rubygems

Version Path
kookaburra-0.14.2 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.14.1 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.14.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.13.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.12.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.11.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.10.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.9.1 lib/kookaburra/ui_driver/mixins/has_browser.rb