Sha256: 9d11449b1f3bddf42e9f369067f5649d7ebd764e022d42c085b1ee5096432c5e

Contents?: true

Size: 660 Bytes

Versions: 10

Compression:

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

      def no_500_error!
        if browser.has_css?('head title', :text => 'Internal Server Error')
          sleep 30 if ENV['GIMME_CRAP']
          raise Unexpected500, browser.body
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kookaburra-0.9.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.8.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.7.2 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.7.1 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.7.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.6.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.5.1 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.5.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.4.0 lib/kookaburra/ui_driver/mixins/has_browser.rb
kookaburra-0.3.1 lib/kookaburra/ui_driver/mixins/has_browser.rb