Sha256: a7bca98e593b5f956c3df9332518abee5e523aa003948205ae08f21d45247c1d

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

get '/jspec/*' do |path|
  send_file JSPEC_ROOT + '/lib/' + path
end

post '/results' do
  require 'json'
  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

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
mattpuchlerz-jspec-2.11.0 server/routes.rb
visionmedia-jspec-2.10.0 server/routes.rb
visionmedia-jspec-2.11.0 server/routes.rb
visionmedia-jspec-2.11.1 server/routes.rb
visionmedia-jspec-2.11.2 server/routes.rb
visionmedia-jspec-2.9.0 server/routes.rb
visionmedia-jspec-2.9.1 server/routes.rb
jspec-2.11.6 server/routes.rb
jspec-2.11.5 server/routes.rb
jspec-2.11.4 server/routes.rb
jspec-2.11.3 server/routes.rb
jspec-2.11.2 server/routes.rb