http-double 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http_double/base.rb +17 -2
- data/lib/http_double/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81b92890f6ab3d244353c676d76e4121fa31fed4
|
4
|
+
data.tar.gz: 82d3959338d38342f31a3dfc979679b02e24848d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753daa964b3d97941360d8ade0c00895412a9eeec9470a064168031700b22b3b6b69dd4a9b195fb01af5d6e71fb6a2eb7530b9eb040edd34fb3a50c264bb29cc
|
7
|
+
data.tar.gz: 7af479a962599e6cae377ddb61419cf8fe88cc212f72592f99c2d98fafc5f420408b462e3e0c0e37bb0495bb175082e1a6c28ccee132a88a9ecabc741895ed66
|
data/lib/http_double/base.rb
CHANGED
@@ -22,9 +22,10 @@ module HttpDouble
|
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
|
-
def background(
|
26
|
-
thread = Thread.new{ foreground
|
25
|
+
def background(addr, port, **args)
|
26
|
+
thread = Thread.new{ foreground addr, port, **args }
|
27
27
|
thread.abort_on_exception = true
|
28
|
+
sleep 0.05 until test_background addr, port
|
28
29
|
thread
|
29
30
|
end
|
30
31
|
|
@@ -36,6 +37,20 @@ module HttpDouble
|
|
36
37
|
@loggers ||= {}
|
37
38
|
end
|
38
39
|
|
40
|
+
private
|
41
|
+
|
42
|
+
def test_background(addr, port)
|
43
|
+
begin
|
44
|
+
http = Net::HTTP.new addr, port
|
45
|
+
http.head '/'
|
46
|
+
true
|
47
|
+
rescue SystemCallError
|
48
|
+
false
|
49
|
+
rescue
|
50
|
+
true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
39
54
|
end
|
40
55
|
|
41
56
|
not_found { [404, ''] }
|
data/lib/http_double/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-double
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil E. Pearson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.0.0
|
117
|
+
version: 3.0.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 3.0.0
|
124
|
+
version: 3.0.0
|
125
125
|
description: Provides a simple way to double HTTP services, APIs etc, for testing.
|
126
126
|
email:
|
127
127
|
- neil@helium.net.au
|