Sha256: dd98f11e0f0d31b704468e04a6128fb51262507ba526dd0122ecd3393d02a9ec

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

begin
  require "capybara-webkit"
rescue LoadError
  STDOUT.print("Could not find Capybara Webkit. Install the capybara-webkit gem.\n")
  exit(1)
end

module Teaspoon
  module Drivers
    class CapybaraWebkitDriver < Base
      def initialize(_ = nil)
      end

      def run_specs(runner, url)
        session.visit(url)

        session.document.synchronize(Teaspoon.configuration.driver_timeout.to_i) do
          done = session.evaluate_script("window.Teaspoon && window.Teaspoon.finished")
          (session.evaluate_script("window.Teaspoon && window.Teaspoon.getMessages()") || []).each do |line|
            runner.process("#{line}\n")
          end
          done
        end
      end

      private

      def session
        @session ||= Capybara::Session.new(:webkit)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
teaspoon-0.9.1 lib/teaspoon/drivers/capybara_webkit_driver.rb
teaspoon-0.9.0 lib/teaspoon/drivers/capybara_webkit_driver.rb