Last active
August 29, 2015 14:18
-
-
Save peterjaap/b7ac50a541e25e2a983f to your computer and use it in GitHub Desktop.
Capistrano Ghostinspector function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'rubygems' | |
require 'curb' | |
namespace :ghostinspector do | |
desc 'Run Ghostinspector test suite' | |
task :testsuite do | |
version = "v1" | |
apikey = "PLACE_API_KEY_HERE" | |
testsuite = "PLACE_TESTSUITE_HASH_HERE" | |
url = "https://api.ghostinspector.com/#{version}/tests/#{testsuite}/execute/\?apiKey\=#{apikey}" | |
curl = Curl::Easy.new(url) | |
curl.perform | |
suiteData = JSON.parse(curl.body_str) | |
if suiteData["code"] != "SUCCESS" | |
error "Ghostinspector test suite failed!" | |
throw 'Aborting.' | |
else | |
puts "Ghostinspector suite tests all ran successfully" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@todo we should add functionality to show where and why it failed; the data is available in the JSON object.