testbeat 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rspec/spec_helper.rb +41 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb20bbc27f50020099e39126ebfd97296c48686
|
4
|
+
data.tar.gz: 2f8ec9d8fc06e4a78f335183c984fd828144ac02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 681e471d5c646060e4226b64976240c4c317435acf47cf76e24f29db5e4bc40888e444a16f275be31978980964a00ccfdb2bc71f791bb3f159be398c9c5230a4
|
7
|
+
data.tar.gz: a0ee67a020553b8b7821b646c4e8319351b51190c7c6cc271bdea09522da02f81cd2cad82040560e0ddbec046f3c0753de97d3e560cb7260805e1ebf09862e76
|
data/lib/rspec/spec_helper.rb
CHANGED
@@ -14,6 +14,26 @@ require "logger"
|
|
14
14
|
# global so we don't need to pass this around to utility classes
|
15
15
|
$logger = Logger.new('testbeat-debug.log')
|
16
16
|
|
17
|
+
HTTP_VERBS = {
|
18
|
+
'COPY' => Net::HTTP::Copy,
|
19
|
+
'DELETE' => Net::HTTP::Delete,
|
20
|
+
'GET' => Net::HTTP::Get,
|
21
|
+
'HEAD' => Net::HTTP::Head,
|
22
|
+
'LOCK' => Net::HTTP::Lock,
|
23
|
+
'MKCOL' => Net::HTTP::Mkcol,
|
24
|
+
'MOVE' => Net::HTTP::Move,
|
25
|
+
'OPTIONS' => Net::HTTP::Options,
|
26
|
+
'PATCH' => Net::HTTP::Patch,
|
27
|
+
'POST' => Net::HTTP::Post,
|
28
|
+
'PROPFIND' => Net::HTTP::Propfind,
|
29
|
+
'PROPPATCH' => Net::HTTP::Proppatch,
|
30
|
+
'PUT' => Net::HTTP::Put,
|
31
|
+
'TRACE' => Net::HTTP::Trace,
|
32
|
+
'UNLOCK' => Net::HTTP::Unlock
|
33
|
+
}
|
34
|
+
|
35
|
+
HTTP_VERB_RESOURCE = /^(COPY|DELETE|GET|HEAD|LOCK|MKCOL|MOVE|OPTIONS|PATCH|POST|PROPFIND|PROPPATCH|PUT|TRACE|UNLOCK)\s+(\S+)/
|
36
|
+
|
17
37
|
class TestbeatNode
|
18
38
|
|
19
39
|
def initialize(nodename)
|
@@ -329,6 +349,7 @@ class TestbeatContext
|
|
329
349
|
|
330
350
|
def parse_description_args(example_group_description_args)
|
331
351
|
a = example_group_description_args[0]
|
352
|
+
|
332
353
|
/unencrypted/i.match(a) {
|
333
354
|
@unencrypted = true
|
334
355
|
}
|
@@ -336,16 +357,17 @@ class TestbeatContext
|
|
336
357
|
/unauthenticated/i.match(a) {
|
337
358
|
@unauthenticated = true
|
338
359
|
}
|
339
|
-
|
340
|
-
|
341
|
-
/(GET|HEAD|POST)\s+(\S*)(.*)/.match(a) { |rest|
|
360
|
+
|
361
|
+
HTTP_VERB_RESOURCE.match(a) { |rest|
|
342
362
|
@rest = true
|
343
363
|
@method = rest[1]
|
344
364
|
@resource = rest[2]
|
345
365
|
}
|
366
|
+
|
346
367
|
/reprovision/i.match(a) {
|
347
368
|
@reprovision = true
|
348
369
|
}
|
370
|
+
|
349
371
|
# idea: nodes that should not be modified (production etc), particularily not through shell
|
350
372
|
#/untouchable/
|
351
373
|
end
|
@@ -381,19 +403,26 @@ class TestbeatRestRequest
|
|
381
403
|
:read_timeout => @timeout
|
382
404
|
) do |http|
|
383
405
|
|
384
|
-
|
385
|
-
|
386
|
-
req = Net::HTTP::Post.new(@testbeat.resource)
|
387
|
-
if @testbeat.form?
|
388
|
-
req.set_form_data(@testbeat.form)
|
389
|
-
end
|
390
|
-
if @testbeat.body?
|
391
|
-
req.body = @testbeat.body
|
392
|
-
end
|
406
|
+
if not HTTP_VERBS.has_key?(@testbeat.method)
|
407
|
+
raise "Testbeat can't find HTTP verb #{@testbeat.method}"
|
393
408
|
end
|
409
|
+
|
410
|
+
req = HTTP_VERBS[@testbeat.method].new(@testbeat.resource)
|
394
411
|
if @testbeat.headers?
|
395
412
|
@testbeat.headers.each {|name, value| req[name] = value }
|
396
413
|
end
|
414
|
+
if @testbeat.form?
|
415
|
+
if not req.methods.include? :set_form_data
|
416
|
+
raise "Testbeat can't set form data for HTTP verb #{@testbeat.method}"
|
417
|
+
end
|
418
|
+
req.set_form_data(@testbeat.form)
|
419
|
+
end
|
420
|
+
if @testbeat.body?
|
421
|
+
if not req.request_body_permitted?
|
422
|
+
raise "Testbeat can't set body for HTTP verb #{@testbeat.method}"
|
423
|
+
end
|
424
|
+
req.body = @testbeat.body
|
425
|
+
end
|
397
426
|
|
398
427
|
@response = http.request(req) # Net::HTTPResponse object
|
399
428
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testbeat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Staffan Olsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|