2
2
require 'pathname'
3
3
require 'json'
4
4
5
- require 'pp'
6
-
7
5
class UnitTests < Sinatra ::Application
8
6
9
7
PWD = Pathname . new ( File . expand_path ( File . dirname ( __FILE__ ) ) )
@@ -66,13 +64,17 @@ def self.get_or_post(url, &block)
66
64
redirect to ( "/test/#{ params [ :names ] } " )
67
65
end
68
66
67
+ # /test/ will run all tests;
68
+ # /test/foo,bar will run just "foo" and "bar" tests.
69
69
get '/test/:names?' do
70
70
names = params [ :names ]
71
71
@suites = names . nil? ? SUITES : names . split ( /,/ ) . uniq
72
72
@unique_asset_string = UNIQUE_ASSET_STRING . to_s
73
73
erb :tests , :locals => { :suites => @suites }
74
74
end
75
75
76
+ # Will read from disk each time. No server restart necessary when the
77
+ # distributable is updated.
76
78
get '/prototype.js' do
77
79
content_type 'text/javascript'
78
80
send_file PATH_TO_PROTOTYPE
@@ -83,7 +85,6 @@ def self.get_or_post(url, &block)
83
85
# (a) they should be more prominent in the directory structure;
84
86
# (b) they should never, ever get cached, and we want to enforce that
85
87
# aggressively.
86
-
87
88
get '/js/tests/:filename' do
88
89
filename = params [ :filename ]
89
90
path = PATH_TO_TEST_JS . join ( filename )
@@ -110,8 +111,6 @@ def self.get_or_post(url, &block)
110
111
:body => request . body . read
111
112
}
112
113
113
- pp response [ :headers ]
114
-
115
114
content_type 'application/json'
116
115
JSON . dump ( response )
117
116
end
0 commit comments