Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/b7ac50a541e25e2a983f to your computer and use it in GitHub Desktop.
Save peterjaap/b7ac50a541e25e2a983f to your computer and use it in GitHub Desktop.
Capistrano Ghostinspector function
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
@peterjaap
Copy link
Author

@todo we should add functionality to show where and why it failed; the data is available in the JSON object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment