lib/cucumber/pro.rb in cucumber-pro-0.0.12 vs lib/cucumber/pro.rb in cucumber-pro-0.0.13

- old
+ new

@@ -3,16 +3,24 @@ require 'cucumber/pro/web_socket/session' require 'cucumber/pro/errors' module Cucumber module Pro - class << self def new(runtime, output, options) create_logger(output) - session = WebSocket::Session.new(url, logger, timeout: config.timeout) - Formatter.new(session) + + working_copy = Scm::WorkingCopy.detect + + if token + working_copy.check_clean + session = WebSocket::Session.new(url, logger, timeout: config.timeout) + else + session = WebSocket::NullSession.new + end + + Formatter.new(session, working_copy) end def configure yield config end @@ -33,12 +41,10 @@ def create_logger(output) @logger = config.logger || Logger.new(output) end def token - result = (config.token || '') - raise(Error::MissingToken.new) if result.empty? - result + config.token end end class Config attr_accessor :url, :logger, :token, :timeout