http-double 0.1.7 → 0.1.8
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 +6 -2
- data/lib/http_double/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a721d997225c62ba548ee917eae40eefdb4d8e3
|
4
|
+
data.tar.gz: 5fe372379cdeec4b1256e51a8b649afb9d59ef61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c09d187246bf27b45ddb38222652ffd42d0a4269a3ebc461ffff4da8c4cada55c02b2cf5ff763acee724a2e9c686411b0742d95b4e8d24e72be0744a2b98e1
|
7
|
+
data.tar.gz: a4205a95567b1862a7133496aaa7b385022b8281bda15e75646924c1c157224dc578d0fddb9b8f4d793c06ea172d9c2cee80e17d7238ebe2816b38b25e104115
|
data/lib/http_double/base.rb
CHANGED
@@ -7,8 +7,9 @@ module HttpDouble
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
-
def use_app(klass)
|
10
|
+
def use_app(klass, &block)
|
11
11
|
@app_class = klass
|
12
|
+
@initializer = block
|
12
13
|
end
|
13
14
|
|
14
15
|
def foreground(addr, port, log_path: '/dev/null', logger: nil)
|
@@ -20,9 +21,12 @@ module HttpDouble
|
|
20
21
|
log_stream = File.open(log_path, 'a')
|
21
22
|
Base.loggers[port] = logger || Logger.new(log_stream)
|
22
23
|
|
24
|
+
initializer = @initializer
|
25
|
+
|
23
26
|
Thin::Server.start(addr, port) do
|
27
|
+
initializer.call if initializer
|
24
28
|
use RequestLogger, server_class.log
|
25
|
-
run app_class
|
29
|
+
run Class === app_class ? app_class.new : app_class
|
26
30
|
end
|
27
31
|
|
28
32
|
end
|
data/lib/http_double/version.rb
CHANGED