22require 'pathname'
33require 'json'
44
5- require 'pp'
6-
75class UnitTests < Sinatra ::Application
86
97 PWD = Pathname . new ( File . expand_path ( File . dirname ( __FILE__ ) ) )
@@ -66,13 +64,17 @@ def self.get_or_post(url, &block)
6664 redirect to ( "/test/#{ params [ :names ] } " )
6765 end
6866
67+ # /test/ will run all tests;
68+ # /test/foo,bar will run just "foo" and "bar" tests.
6969 get '/test/:names?' do
7070 names = params [ :names ]
7171 @suites = names . nil? ? SUITES : names . split ( /,/ ) . uniq
7272 @unique_asset_string = UNIQUE_ASSET_STRING . to_s
7373 erb :tests , :locals => { :suites => @suites }
7474 end
7575
76+ # Will read from disk each time. No server restart necessary when the
77+ # distributable is updated.
7678 get '/prototype.js' do
7779 content_type 'text/javascript'
7880 send_file PATH_TO_PROTOTYPE
@@ -83,7 +85,6 @@ def self.get_or_post(url, &block)
8385 # (a) they should be more prominent in the directory structure;
8486 # (b) they should never, ever get cached, and we want to enforce that
8587 # aggressively.
86-
8788 get '/js/tests/:filename' do
8889 filename = params [ :filename ]
8990 path = PATH_TO_TEST_JS . join ( filename )
@@ -110,8 +111,6 @@ def self.get_or_post(url, &block)
110111 :body => request . body . read
111112 }
112113
113- pp response [ :headers ]
114-
115114 content_type 'application/json'
116115 JSON . dump ( response )
117116 end
0 commit comments