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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb89445f8247604e9ecec1820a8745079d0a566c
4
- data.tar.gz: 79f37dd1e89778680590e15234f18e8c0e87707e
3
+ metadata.gz: ddce8846e2c8ee613e8336b12dd3e2cced6b74ec
4
+ data.tar.gz: 98afcf85f9c18a20a6cd945cc4173c542bc4ac05
5
5
  SHA512:
6
- metadata.gz: 0ed4d5c31b4cd7befba7fedda9914208b6018528d8d8e4e3264db6602656b5c324946a1a3eb6bf8f4246eb571b5532435ee80686c2592bc2ff679a5052c799a0
7
- data.tar.gz: 5c6d2b77584c6a93f4f35c1710dc33068e03ede57b097b11069293f1e0d9598efefe4dead04dad3900e86dbae4191fb41841c4a6a55f84f0e3eace93e9f01742
6
+ metadata.gz: 80f9ffbf21b56afc917ab9838c7c72c9177e876a7ac662cbec011c6bfcd7cccf3f297f1d31f25d9846c2dd477b1511bfd92f4940f3e25c7d98794cf035a83613
7
+ data.tar.gz: d7a006300cf53bdcbabbd08b54ff9ec709527df88a54141c4e44139b6ce816e33dbcbd134b0cea072ff03c9baf5547352cb453553f0e99903728a99749fe8d07
@@ -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
- Thin::Logging.trace_logger = logger || Logger.new(log_stream)
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
@@ -1,3 +1,3 @@
1
1
  module HttpDouble
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
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.3
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-06 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra