Sha256: bbe832d9976270f18d057b0325134dc53b7df5877f1a0c492eb36f3a3dc8369e
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require "capybara" module Konacha class Runner def self.start new.run end attr_reader :reporter def initialize @reporter = Konacha::Reporter.new(*formatters) end def run session.visit('/') events_consumed = 0 done = false begin sleep 0.1 events = JSON.parse(session.evaluate_script('window.top.Konacha.getEvents()')) if events events[events_consumed..-1].each do |event| done = true if event['event'] == 'end' reporter.process_mocha_event(event) end events_consumed = events.length end end until done reporter.passed? rescue => e raise e, "Error communicating with browser process: #{e}", e.backtrace end def session @session ||= Capybara::Session.new(Konacha.driver, Konacha.application) end private def formatters if ENV['FORMAT'] ENV['FORMAT'].split(',').map do |string| eval(string).new(STDOUT) end else [Konacha::Formatter.new(STDOUT)] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
konacha-2.2.0 | lib/konacha/runner.rb |
konacha-2.1.0 | lib/konacha/runner.rb |