mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
83267cdd45
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92560 467b73ca-7a2a-4603-9d3b-597d59a354a9
58 lines
1.4 KiB
Ruby
58 lines
1.4 KiB
Ruby
|
|
get '/jspec/*' do |path|
|
|
send_file JSPEC_ROOT + '/lib/' + path
|
|
end
|
|
|
|
post '/results' do
|
|
require 'json/pure'
|
|
data = JSON.parse request.body.read
|
|
if data['options'].include?('verbose') && data['options']['verbose'] ||
|
|
data['options'].include?('failuresOnly') && data['options']['failuresOnly']
|
|
puts "\n\n %s Passes: %s Failures: %s\n\n" % [
|
|
bold(browser_name),
|
|
green(data['stats']['passes']),
|
|
red(data['stats']['failures'])]
|
|
data['results'].compact.each do |suite|
|
|
specs = suite['specs'].compact.map do |spec|
|
|
case spec['status'].to_sym
|
|
when :pass
|
|
next if data['options'].include?('failuresOnly') && data['options']['failuresOnly']
|
|
' ' + green(spec['description']) + assertion_graph_for(spec['assertions']).to_s + "\n"
|
|
when :fail
|
|
" #{red(spec['description'])}\n #{spec['message']}\n\n"
|
|
else
|
|
" #{blue(spec['description'])}\n"
|
|
end
|
|
end.join
|
|
unless specs.strip.empty?
|
|
puts "\n " + bold(suite['description'])
|
|
puts specs
|
|
end
|
|
end
|
|
else
|
|
puts "%20s Passes: %s Failures: %s" % [
|
|
bold(browser_name),
|
|
green(data['stats']['passes']),
|
|
red(data['stats']['failures'])]
|
|
end
|
|
halt 200
|
|
end
|
|
|
|
get '/*' do |path|
|
|
pass unless File.exists?(path)
|
|
send_file path
|
|
end
|
|
|
|
#--
|
|
# Simulation Routes
|
|
#++
|
|
|
|
get '/slow/*' do |seconds|
|
|
sleep seconds.to_i
|
|
halt 200
|
|
end
|
|
|
|
get '/status/*' do |code|
|
|
halt code.to_i
|
|
end
|