hayabusa 0.0.24 → 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +363 -0
- data/Rakefile +0 -14
- data/bin/hayabusa_fcgi.fcgi +1 -0
- data/bin/hayabusa_fcgi_server.rb +0 -1
- data/lib/hayabusa.rb +124 -118
- data/lib/hayabusa_cgi_tools.rb +4 -2
- data/lib/hayabusa_client_session.rb +3 -1
- data/lib/hayabusa_database.rb +84 -84
- data/lib/hayabusa_datarow.rb +873 -0
- data/lib/hayabusa_ext/mailing.rb +8 -7
- data/lib/hayabusa_ext/web.rb +5 -0
- data/lib/hayabusa_fcgi.rb +13 -4
- data/lib/hayabusa_http_session.rb +2 -0
- data/lib/hayabusa_http_session_contentgroup.rb +7 -1
- data/lib/hayabusa_http_session_request.rb +7 -1
- data/lib/hayabusa_http_session_response.rb +30 -29
- data/lib/hayabusa_objects.rb +1455 -0
- data/lib/hayabusa_revision.rb +347 -0
- data/lib/kernel_ext/magic_methods.rb +4 -0
- data/lib/models/log.rb +27 -27
- data/lib/models/log_access.rb +20 -20
- data/lib/models/log_data.rb +6 -6
- data/lib/models/log_data_link.rb +2 -2
- data/lib/models/log_data_value.rb +5 -5
- data/lib/models/log_link.rb +12 -12
- data/lib/models/session.rb +6 -6
- metadata +125 -126
- data/.document +0 -5
- data/.rspec +0 -1
- data/Gemfile +0 -24
- data/Gemfile.lock +0 -70
- data/README.rdoc +0 -315
- data/VERSION +0 -1
- data/bin/hayabusa_fcgi.fcgi +0 -42
- data/conf/apache2_cgi_rhtml_conf.conf +0 -10
- data/conf/apache2_fcgi_rhtml_conf.conf +0 -22
- data/conf/apache2_hayabusa_conf.conf +0 -15
- data/hayabusa.gemspec +0 -167
- data/pages/benchmark.rhtml +0 -0
- data/pages/benchmark_print.rhtml +0 -14
- data/pages/benchmark_simple.rhtml +0 -3
- data/pages/benchmark_threadded_content.rhtml +0 -21
- data/pages/config_cgi.rb +0 -22
- data/pages/config_fcgi.rb +0 -22
- data/pages/debug_database_connections.rhtml +0 -46
- data/pages/debug_http_sessions.rhtml +0 -40
- data/pages/debug_memory_usage.rhtml +0 -39
- data/pages/error_notfound.rhtml +0 -12
- data/pages/image.png +0 -0
- data/pages/logs_latest.rhtml +0 -57
- data/pages/logs_show.rhtml +0 -32
- data/pages/spec.rhtml +0 -41
- data/pages/spec_exit.rhtml +0 -5
- data/pages/spec_multiple_threads.rhtml +0 -18
- data/pages/spec_sleeper.rhtml +0 -4
- data/pages/spec_test_multiple_clients.rhtml +0 -3
- data/pages/spec_thread_joins.rhtml +0 -29
- data/pages/spec_threadded_content.rhtml +0 -40
- data/pages/spec_vars_get.rhtml +0 -4
- data/pages/spec_vars_header.rhtml +0 -3
- data/pages/spec_vars_post.rhtml +0 -4
- data/pages/spec_vars_post_fileupload.rhtml +0 -19
- data/pages/testpic.jpeg +0 -0
- data/pages/tests.rhtml +0 -14
- data/pages/threadded_content_test.rhtml +0 -23
- data/spec/fcgi_multiple_processes_spec.rb +0 -104
- data/spec/hayabusa_spec.rb +0 -423
- data/spec/spec_helper.rb +0 -12
- data/spec/test_upload.xlsx +0 -0
data/spec/hayabusa_spec.rb
DELETED
@@ -1,423 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Hayabusa" do
|
4
|
-
require "rubygems"
|
5
|
-
require "sqlite3" if RUBY_ENGINE != "jruby"
|
6
|
-
require "json"
|
7
|
-
require "RMagick"
|
8
|
-
|
9
|
-
begin
|
10
|
-
require "#{File.realpath(File.dirname(__FILE__))}/../../knjrbfw/lib/knjrbfw.rb"
|
11
|
-
rescue LoadError
|
12
|
-
require "knjrbfw"
|
13
|
-
end
|
14
|
-
|
15
|
-
require "#{File.realpath(File.dirname(__FILE__))}/../lib/hayabusa.rb"
|
16
|
-
|
17
|
-
begin
|
18
|
-
require "#{File.realpath(File.dirname(__FILE__))}/../../http2/lib/http2.rb"
|
19
|
-
puts "Loaded custom version of Http2."
|
20
|
-
rescue LoadError
|
21
|
-
require "http2"
|
22
|
-
puts "Loaded normal gem version of Http2."
|
23
|
-
end
|
24
|
-
|
25
|
-
db_path = "#{Knj::Os.tmpdir}/hayabusa_rspec.sqlite3"
|
26
|
-
File.unlink(db_path) if File.exists?(db_path)
|
27
|
-
|
28
|
-
db = Knj::Db.new(
|
29
|
-
:type => "sqlite3",
|
30
|
-
:path => db_path,
|
31
|
-
:return_keys => "symbols"
|
32
|
-
)
|
33
|
-
|
34
|
-
$appserver = Hayabusa.new(
|
35
|
-
:debug => false,
|
36
|
-
:title => "SpecTest",
|
37
|
-
:port => 1515,
|
38
|
-
:doc_root => "#{File.dirname(__FILE__)}/../pages",
|
39
|
-
:locales_gettext_funcs => true,
|
40
|
-
:locale_default => "da_DK",
|
41
|
-
:db => db,
|
42
|
-
:threadding => {
|
43
|
-
:priority => -3
|
44
|
-
}
|
45
|
-
)
|
46
|
-
|
47
|
-
$appserver.config[:handlers] << {
|
48
|
-
:regex => /^\/Kasper$/,
|
49
|
-
:callback => proc{|data|
|
50
|
-
data[:httpsession].page_path = nil
|
51
|
-
|
52
|
-
eruby = data[:httpsession].eruby
|
53
|
-
eruby.connect(:on_error) do |e|
|
54
|
-
_hb.handle_error(e)
|
55
|
-
end
|
56
|
-
|
57
|
-
eruby.import("#{File.dirname(__FILE__)}/../pages/spec.rhtml")
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
$appserver.vars[:test] = "kasper"
|
62
|
-
$appserver.define_magic_var(:_testvar1, "Kasper")
|
63
|
-
$appserver.define_magic_var(:_testvar2, "Johansen")
|
64
|
-
$appserver.start
|
65
|
-
|
66
|
-
raise "Expected thread-pool-priority to be '-3' but it wasnt: '#{$appserver.threadpool.args[:priority]}'." if $appserver.threadpool.args[:priority] != -3
|
67
|
-
|
68
|
-
http = Http2.new(:host => "localhost", :port => 80, :encoding_gzip => false, :debug => false) rescue nil
|
69
|
-
|
70
|
-
$testmodes = [{
|
71
|
-
:name => :standalone,
|
72
|
-
:path_pre => "",
|
73
|
-
:http => Http2.new(:host => "localhost", :port => 1515, :debug => false)
|
74
|
-
}]
|
75
|
-
|
76
|
-
if http
|
77
|
-
$testmodes += [{
|
78
|
-
:name => :cgi,
|
79
|
-
:path_pre => "hayabusa_cgi_test/",
|
80
|
-
:http => http
|
81
|
-
},{
|
82
|
-
:name => :fcgi,
|
83
|
-
:path_pre => "hayabusa_fcgi_test/",
|
84
|
-
:http => http
|
85
|
-
}]
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should be able to get multiple pictures" do
|
89
|
-
require "base64"
|
90
|
-
|
91
|
-
# Symlink 'image.rhtml' first.
|
92
|
-
img_from_path = "#{Knj.knjrbfw_path}/webscripts/image.rhtml"
|
93
|
-
img_to_path = "#{File.realpath("#{File.dirname(__FILE__)}/../pages")}/image.rhtml"
|
94
|
-
|
95
|
-
raise "Invalid from path: '#{img_from_path}'." unless File.exists?(img_from_path)
|
96
|
-
|
97
|
-
File.unlink(img_to_path) if File.symlink?(img_to_path)
|
98
|
-
File.symlink(img_from_path, img_to_path)
|
99
|
-
|
100
|
-
last_tdata = nil
|
101
|
-
|
102
|
-
begin
|
103
|
-
$testmodes.each do |tdata|
|
104
|
-
last_tdata = tdata
|
105
|
-
|
106
|
-
3.times do
|
107
|
-
path = "#{File.dirname(__FILE__)}/../pages/testpic.jpeg"
|
108
|
-
|
109
|
-
res = tdata[:http].get("#{tdata[:path_pre]}testpic.jpeg")
|
110
|
-
res.body.bytesize.should eql(File.size(path))
|
111
|
-
|
112
|
-
res.body.bytes.to_a.should eql(File.read(path).bytes.to_a)
|
113
|
-
|
114
|
-
#puts "Getting forced image through #{tdata[:name]}"
|
115
|
-
res = tdata[:http].get("#{tdata[:path_pre]}image.rhtml?force=true&path64=#{Base64.encode64("testpic.jpeg").to_s.strip}")
|
116
|
-
|
117
|
-
#puts "Getting normal image through #{tdata[:name]}"
|
118
|
-
res1 = tdata[:http].get("#{tdata[:path_pre]}image.rhtml?path64=#{Base64.encode64("image.png").to_s.strip}&rounded_corners=8&width=550")
|
119
|
-
res1.contenttype.should eql("image/png")
|
120
|
-
|
121
|
-
#puts "Getting exit-script through #{tdata[:name]}"
|
122
|
-
res_exit = tdata[:http].get("#{tdata[:path_pre]}spec_exit.rhtml")
|
123
|
-
res_exit.body.should eql("ExitOutput\n")
|
124
|
-
res_exit.code.to_i.should eql(304)
|
125
|
-
|
126
|
-
#puts "Getting normal image through #{tdata[:name]}"
|
127
|
-
res2 = tdata[:http].get("#{tdata[:path_pre]}image.rhtml?path64=#{Base64.encode64("image.png").to_s.strip}&rounded_corners=8&width=550")
|
128
|
-
res2.contenttype.should eql("image/png")
|
129
|
-
|
130
|
-
res1.body.bytesize.should eql(res2.body.bytesize)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
rescue => e
|
134
|
-
puts "Mode: #{last_tdata[:name]}" if last_tdata
|
135
|
-
STDERR.puts e.inspect
|
136
|
-
STDERR.puts e.backtrace
|
137
|
-
raise e
|
138
|
-
ensure
|
139
|
-
File.unlink(img_to_path) if File.exists?(img_to_path)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
#it "should be able to handle custom urls" do
|
144
|
-
# $testmodes.each do |tdata|
|
145
|
-
# res = tdata[:http].get("#{tdata[:path_pre]}Kasper")
|
146
|
-
# raise "Expected data to be 'Test' in mode '#{tdata[:name]}' but it wasnt: '#{res.body}'." if res.body != "Test"
|
147
|
-
# end
|
148
|
-
#end
|
149
|
-
|
150
|
-
it "should be able to upload files" do
|
151
|
-
$testmodes.each do |tdata|
|
152
|
-
fpaths = {
|
153
|
-
"fpath1" => "#{File.realpath(File.dirname(__FILE__))}/../pages/spec_thread_joins.rhtml",
|
154
|
-
"fpath2" => "#{File.realpath(File.dirname(__FILE__))}/test_upload.xlsx"
|
155
|
-
}
|
156
|
-
|
157
|
-
res = tdata[:http].post_multipart(:url => "#{tdata[:path_pre]}spec_vars_post_fileupload.rhtml", :post => {
|
158
|
-
"testfile1" => {
|
159
|
-
:filename => "spec_thread_joins.rhtml",
|
160
|
-
:fpath => fpaths["fpath1"]
|
161
|
-
},
|
162
|
-
"testfile2" => {
|
163
|
-
:filename => "test_upload.xlsx",
|
164
|
-
:fpath => fpaths["fpath2"]
|
165
|
-
}
|
166
|
-
})
|
167
|
-
|
168
|
-
1.upto(2) do |count|
|
169
|
-
data = Marshal.load(res.body)
|
170
|
-
raise "No data returned?" unless data
|
171
|
-
|
172
|
-
if count != 2
|
173
|
-
key = "testfile#{count}"
|
174
|
-
raise "Not defined in returned data: '#{key}' in '#{data}'." unless data.key?(key)
|
175
|
-
if data[key]["val"] != File.read(fpaths["fpath#{count}"])
|
176
|
-
File.open("/tmp/hayabusa_spec_testfile#{count}_1", "w") do |fp|
|
177
|
-
fp.puts("Class: #{data["testfile#{count}"].class.name}")
|
178
|
-
fp.write(data["testfile#{count}"])
|
179
|
-
end
|
180
|
-
|
181
|
-
File.open("/tmp/hayabusa_spec_testfile#{count}_2", "w") do |fp|
|
182
|
-
fp.write(File.read(fpaths["fpath#{count}"]))
|
183
|
-
end
|
184
|
-
|
185
|
-
raise "Expected uploaded data for mode '#{tdata[:name]}' to be the same but it wasnt:\n\"#{data["testfile#{count}"]}\"\n\n\"#{File.read(fpaths["fpath#{count}"])}\""
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
raise "Expected 'testfile' class to be 'Hayabusa::Http_session::Post_multipart::File_upload' in mode '#{tdata[:name]}' but it wasnt: '#{data["testfile#{count}"]["class"]}'." if data["testfile#{count}"]["class"] != "Hayabusa::Http_session::Post_multipart::File_upload"
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should be able to handle a GET-request." do
|
195
|
-
$testmodes.each do |tdata|
|
196
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec.rhtml")
|
197
|
-
raise "Unexpected HTML: '#{res.body}'." if res.body.to_s != "Test"
|
198
|
-
|
199
|
-
#Check that URL-decoding are being done.
|
200
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec.rhtml?choice=check_get_parse&value=#{Knj::Web.urlenc("gfx/nopic.png")}")
|
201
|
-
raise "Unexpected HTML: '#{res.body}'." if res.body.to_s != "gfx/nopic.png"
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
it "should be able to handle a HEAD-request." do
|
206
|
-
#Http2 doesnt support head?
|
207
|
-
#res = $http.head("spec.rhtml")
|
208
|
-
#raise "HEAD-request returned content - it shouldnt?" if res.body.to_s.length > 0
|
209
|
-
end
|
210
|
-
|
211
|
-
it "should be able to handle a POST-request." do
|
212
|
-
$testmodes.each do |tdata|
|
213
|
-
res = tdata[:http].post(:url => "#{tdata[:path_pre]}spec.rhtml", :post => {
|
214
|
-
"postdata" => "Test post"
|
215
|
-
})
|
216
|
-
raise "POST-request did not return expected data: '#{res.body}' for '#{tdata[:name]}' data: '#{res.body}'." if res.body.to_s.strip != "Test post"
|
217
|
-
|
218
|
-
res = tdata[:http].post(:url => "#{tdata[:path_pre]}spec.rhtml?choice=dopostconvert", :post => {
|
219
|
-
"postdata" => "Test post",
|
220
|
-
"array" => ["a", "b", "d"]
|
221
|
-
})
|
222
|
-
data = JSON.parse(res.body)
|
223
|
-
raise "Expected posted data restored but it wasnt: '#{data}'." if data["array"]["0"] != "a" or data["array"]["1"] != "b" or data["array"]["2"] != "d"
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
it "should be able to join the server so other tests can be made manually." do
|
228
|
-
begin
|
229
|
-
Timeout.timeout(1) do
|
230
|
-
$appserver.join
|
231
|
-
raise "Appserver didnt join."
|
232
|
-
end
|
233
|
-
rescue Timeout::Error
|
234
|
-
#ignore.
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
it "should be able to use the header-methods." do
|
239
|
-
$testmodes.each do |tdata|
|
240
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec.rhtml")
|
241
|
-
raise "Normal header data could not be detected." if res.header("testheader") != "NormalHeader"
|
242
|
-
raise "Raw header data could not be detected." if res.header("testraw") != "RawHeader"
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
it "should be able to set and get multiple cookies at the same time." do
|
247
|
-
$testmodes.each do |tdata|
|
248
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec.rhtml?choice=test_cookie")
|
249
|
-
raise res.body if res.body.to_s.length > 0
|
250
|
-
|
251
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec.rhtml?choice=get_cookies")
|
252
|
-
parsed = JSON.parse(res.body)
|
253
|
-
|
254
|
-
raise "Unexpected value for 'TestCookie': '#{parsed["TestCookie"]}'." if parsed["TestCookie"] != "TestValue"
|
255
|
-
raise "Unexpected value for 'TestCookie2': '#{parsed["TestCookie2"]}'." if parsed["TestCookie2"] != "TestValue2"
|
256
|
-
raise "Unexpected value for 'TestCookie3': '#{parsed["TestCookie3"]}'." if parsed["TestCookie3"] != "TestValue 3 "
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
it "should be able to run the rspec_threadded_content test correctly." do
|
261
|
-
$testmodes.each do |tdata|
|
262
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec_threadded_content.rhtml")
|
263
|
-
raise "Expected body to be '12345678910' for mode '#{tdata[:name]}' but it wasnt: '#{res.body.to_s}'." if res.body.to_s != "12345678910"
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
it "should be able to add a timeout." do
|
268
|
-
$break_timeout = false
|
269
|
-
timeout = $appserver.timeout(:time => 1) do
|
270
|
-
$break_timeout = true
|
271
|
-
end
|
272
|
-
|
273
|
-
Timeout.timeout(2) do
|
274
|
-
loop do
|
275
|
-
break if $break_timeout
|
276
|
-
sleep 0.1
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
it "should be able to stop a timeout." do
|
282
|
-
$timeout_runned = false
|
283
|
-
timeout = $appserver.timeout(:time => 1) do
|
284
|
-
$timeout_runned = true
|
285
|
-
end
|
286
|
-
|
287
|
-
sleep 0.5
|
288
|
-
timeout.stop
|
289
|
-
|
290
|
-
begin
|
291
|
-
Timeout.timeout(1.5) do
|
292
|
-
loop do
|
293
|
-
raise "The timeout ran even though stop was called?" if $timeout_runned
|
294
|
-
sleep 0.1
|
295
|
-
end
|
296
|
-
end
|
297
|
-
rescue Timeout::Error
|
298
|
-
#the timeout didnt run - and it shouldnt so dont do anything.
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
it "should be able to join threads tarted from _hb.thread." do
|
303
|
-
$testmodes.each do |tdata|
|
304
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec_thread_joins.rhtml")
|
305
|
-
raise res.body if res.body.to_s != "12345"
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
|
-
it "should be able to properly parse special characters in post-requests." do
|
310
|
-
$testmodes.each do |tdata|
|
311
|
-
res = tdata[:http].post(:url => "#{tdata[:path_pre]}spec_vars_post.rhtml", :post => {
|
312
|
-
"test" => "123+456%789%20"
|
313
|
-
})
|
314
|
-
data = JSON.parse(res.body)
|
315
|
-
raise res.body if data["test"] != "123+456%789%20"
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
it "should be able to do logging" do
|
320
|
-
class ::TestModels
|
321
|
-
class Person < Knj::Datarow
|
322
|
-
|
323
|
-
end
|
324
|
-
end
|
325
|
-
|
326
|
-
Knj::Db::Revision.new.init_db("db" => $appserver.db, "schema" => {
|
327
|
-
"tables" => {
|
328
|
-
"Person" => {
|
329
|
-
"columns" => [
|
330
|
-
{"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true},
|
331
|
-
{"name" => "name", "type" => "varchar"}
|
332
|
-
]
|
333
|
-
}
|
334
|
-
}
|
335
|
-
})
|
336
|
-
|
337
|
-
ob = Knj::Objects.new(
|
338
|
-
:db => $appserver.db,
|
339
|
-
:datarow => true,
|
340
|
-
:require => false,
|
341
|
-
:module => ::TestModels
|
342
|
-
)
|
343
|
-
|
344
|
-
person = ob.add(:Person, :name => "Kasper")
|
345
|
-
|
346
|
-
$appserver.log("This is a test", person)
|
347
|
-
logs = $appserver.ob.list(:Log, "object_lookup" => person).to_a
|
348
|
-
raise "Expected count to be 1 but got: #{logs.length}" if logs.length != 1
|
349
|
-
|
350
|
-
$appserver.logs_delete(person)
|
351
|
-
|
352
|
-
logs = $appserver.ob.list(:Log, "object_lookup" => person).to_a
|
353
|
-
raise "Expected count to be 0 but got: #{logs.length}" if logs.length != 0
|
354
|
-
end
|
355
|
-
|
356
|
-
it "should handle multi-threadding well" do
|
357
|
-
ts = []
|
358
|
-
es = []
|
359
|
-
|
360
|
-
#Execute multiple threads to test FCGI-proxy and thread-safety.
|
361
|
-
1.upto(5) do
|
362
|
-
$testmodes.each do |tdata|
|
363
|
-
ts << Thread.new do
|
364
|
-
begin
|
365
|
-
res = tdata[:http].post(:url => "#{tdata[:path_pre]}spec_vars_post.rhtml", :post => {
|
366
|
-
"test_special_chars" => "1%23+-456",
|
367
|
-
"var" => {
|
368
|
-
0 => 1,
|
369
|
-
1 => 2,
|
370
|
-
3 => {
|
371
|
-
"kasper" => 5,
|
372
|
-
"arr" => ["a", "b", "c"]
|
373
|
-
}
|
374
|
-
}
|
375
|
-
})
|
376
|
-
|
377
|
-
begin
|
378
|
-
data = JSON.parse(res.body)
|
379
|
-
rescue JSON::GeneratorError
|
380
|
-
raise "Could not parse JSON from result: '#{res.body}'."
|
381
|
-
end
|
382
|
-
|
383
|
-
begin
|
384
|
-
raise "Expected hash to be a certain way: '#{data}'." if data["var"]["0"] != "1" or data["var"]["1"] != "2" or data["var"]["3"]["kasper"] != "5" or data["var"]["3"]["arr"]["0"] != "a" or data["var"]["3"]["arr"]["1"] != "b"
|
385
|
-
rescue => e
|
386
|
-
raise "Error when parsing result: '#{data}'."
|
387
|
-
end
|
388
|
-
|
389
|
-
raise "Expected 'test_special_chars' to be '1%23+-456' but it wasnt: '#{data["test_special_chars"]}'." if data["test_special_chars"] != "1%23+-456"
|
390
|
-
|
391
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec_threadded_content.rhtml")
|
392
|
-
raise "Expected body to be '12345678910' but it was: '#{res.body}'." if res.body != "12345678910"
|
393
|
-
|
394
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec_vars_get.rhtml?var[]=1&var[]=2&var[]=3&var[3][kasper]=5")
|
395
|
-
data = JSON.parse(res.body)
|
396
|
-
raise "Expected hash to be a certain way: '#{data}'." if data["var"]["0"] != "1" or data["var"]["1"] != "2" or data["var"]["3"]["kasper"] != "5"
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
res = tdata[:http].get("#{tdata[:path_pre]}spec_vars_header.rhtml")
|
401
|
-
raise "Expected header 'testheader' to be 'TestValue' but it wasnt: '#{res.header("testheader")}'." if res.header("testheader") != "TestValue"
|
402
|
-
rescue => e
|
403
|
-
es << e
|
404
|
-
puts e.inspect
|
405
|
-
puts e.backtrace
|
406
|
-
end
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
ts.each do |t|
|
411
|
-
t.join
|
412
|
-
end
|
413
|
-
|
414
|
-
es.each do |e|
|
415
|
-
raise e
|
416
|
-
end
|
417
|
-
end
|
418
|
-
end
|
419
|
-
|
420
|
-
it "should be able to stop." do
|
421
|
-
$appserver.stop
|
422
|
-
end
|
423
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'hayabusa'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|
data/spec/test_upload.xlsx
DELETED
Binary file
|