http-double 0.1.3 → 0.1.4
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 +5 -1
- data/lib/http_double/thin_logging.rb +13 -0
- data/lib/http_double/version.rb +1 -1
- 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: ddce8846e2c8ee613e8336b12dd3e2cced6b74ec
|
4
|
+
data.tar.gz: 98afcf85f9c18a20a6cd945cc4173c542bc4ac05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80f9ffbf21b56afc917ab9838c7c72c9177e876a7ac662cbec011c6bfcd7cccf3f297f1d31f25d9846c2dd477b1511bfd92f4940f3e25c7d98794cf035a83613
|
7
|
+
data.tar.gz: d7a006300cf53bdcbabbd08b54ff9ec709527df88a54141c4e44139b6ce816e33dbcbd134b0cea072ff03c9baf5547352cb453553f0e99903728a99749fe8d07
|
data/lib/http_double/base.rb
CHANGED
@@ -13,7 +13,7 @@ module HttpDouble
|
|
13
13
|
# Even if we use /dev/null, we need a logger to suppress warnings
|
14
14
|
# generated by Thin::Logging#trace_logger being undefined
|
15
15
|
log_stream = File.open(log_path, 'a')
|
16
|
-
|
16
|
+
Base.loggers[port] = logger || Logger.new(log_stream)
|
17
17
|
|
18
18
|
Thin::Server.start(addr, port) do
|
19
19
|
use RequestLogger, server_class.log
|
@@ -32,6 +32,10 @@ module HttpDouble
|
|
32
32
|
@log ||= []
|
33
33
|
end
|
34
34
|
|
35
|
+
def loggers
|
36
|
+
@loggers ||= {}
|
37
|
+
end
|
38
|
+
|
35
39
|
end
|
36
40
|
|
37
41
|
not_found { [404, ''] }
|
@@ -18,3 +18,16 @@ module Thin::Logging
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
# This patch tries to ensure Thin is using the correct logger in cases where multiple
|
23
|
+
# doubles are running. This method is not foolproof.
|
24
|
+
|
25
|
+
class Thin::Connection
|
26
|
+
alias_method :receive_data_original, :receive_data
|
27
|
+
|
28
|
+
def receive_data(data)
|
29
|
+
logger = HttpDouble::Base.loggers[backend.port]
|
30
|
+
Thin::Logging.trace_logger = logger if logger.respond_to? :level
|
31
|
+
receive_data_original data
|
32
|
+
end
|
33
|
+
end
|
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.4
|
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-06-
|
11
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|