Sha256: 874c1e3a6818ff4711ac56330d0737e6f8388b233a5ac610618c1f7a38523fe0

Contents?: true

Size: 1008 Bytes

Versions: 3

Compression:

Stored size: 1008 Bytes

Contents

if defined?(Cucumber)
	After do |scenario|
	  if Capybara.drivers.include?(:testingbot) && File.exists?(File.expand_path("~/.testingbot"))
	  	unless Capybara.drivers[:testingbot].call.browser.nil?
	  		session_id = Capybara.drivers[:testingbot].call.browser.instance_variable_get("@bridge").instance_variable_get("@session_id")

			str = File.open(File.expand_path("~/.testingbot")) { |f| f.readline }.chomp
		    client_key, client_secret = str.split(':')
		    
		    params = {
		        "session_id" => session_id,
		        "client_key" => client_key,
		        "client_secret" => client_secret,
		        "status_message" => (scenario.failed? ? scenario.exception.message : ""),
		        "success" => !scenario.failed?,
		        "name" => scenario.title,
		        "kind" => 2
		    }
		    
		    url = URI.parse('http://testingbot.com/hq')
		    http = Net::HTTP.new(url.host, url.port)
		    response = http.post(url.path, params.map { |k, v| "#{k.to_s}=#{v}" }.join("&"))
	  	end
	  end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
testingbot-0.0.8 lib/testingbot/cucumber.rb
testingbot-0.0.7 lib/testingbot/cucumber.rb
testingbot-0.0.6 lib/testingbot/cucumber.rb