pinch_hitter 0.5.2 → 0.5.3

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: 4f6fb6f73cf81d612aaeea9f9f6e001e59c38255
4
- data.tar.gz: 2065632b48f49c16e80ed799d9b93e1f94104082
3
+ metadata.gz: 088d1d1c1d4f9b7dbfbefcd5e1edcbcbe7b469f6
4
+ data.tar.gz: 8eaf85f09bb6659b41c0aba77d6e11a618cffeba
5
5
  SHA512:
6
- metadata.gz: 5c03d3d5f7cc6413a913b10c71499705146332a2440496cbe6fc79de9bf1785f3871ada32e5f1969e70feb274556abf967ccfc810ed9e5baf771bf1b18890816
7
- data.tar.gz: 8ca146df200cf8dcf07d84e0427d75fcefe752460919b300f2d6720520731709801ea1fce2bcf3ed73001b0f5dcf997aa7e6314ed29aa104317f4de90a6c5d1d
6
+ metadata.gz: f477896752ca0759216d711d2229b38e98a52b3369a2b37ac22c42c0b5540f27e45d1a5416aff655e52137b6ebbc48318b19f1bab24cb0ac12a38064bbd7451a
7
+ data.tar.gz: 53778f0cac8e04f3cf1e5cd4d74c2022b0e012b7264deb86810dda0f7f64eb33971d40a79452023d9e374b220d53ef660697541ff51f69cd5dcc598963b66549
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - 1.9.2
5
4
  - 2.0.0
6
- - 2.1.1
5
+ - 2.1.5
6
+ - 2.2.2
data/Changelog CHANGED
@@ -20,3 +20,7 @@ Add ability to register modules for custom message handling
20
20
  === Release 0.5.2 / 2014-8-8
21
21
  * Fix edge case where storing simple messages would fail without a messages
22
22
  directory. Thanks to Dan Parks and Nathan Wallace for pointing it out!
23
+
24
+ === Release 0.5.3 / 2015-8-14
25
+ * Add ability to silence the sintatra/webrick output and keep it out of the
26
+ test logs.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Steve Jackson
1
+ Copyright (c) 2015 Steve Jackson
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,22 +1,36 @@
1
1
  require 'rack'
2
+ require 'logger'
2
3
  require 'webrick'
3
4
  require 'pinch_hitter/service/replay_ws'
4
5
 
5
6
  module PinchHitter::Service::Runner
7
+ def silence_console
8
+ @silent_console = true
9
+ end
10
+
6
11
  def start_service(host, port, timeout=10)
7
12
  Thread.abort_on_exception = true
8
13
  @app = PinchHitter::Service::ReplayWs.new
9
14
  @replay_service = Thread.new do
10
- Rack::Handler::WEBrick.run @app, :Host => host, :Port => port
15
+ Rack::Handler::WEBrick.run @app, service_options(host, port)
11
16
  end
12
17
  wait_for_replay(timeout)
13
18
  end
14
19
 
20
+ def service_options(host, port)
21
+ {}.tap do |hash|
22
+ hash[:Host] = host
23
+ hash[:Port] = port
24
+ hash[:AccessLog] = [] if @silent_console
25
+ hash[:Logger] = SilentLogger.new if @silent_console
26
+ end
27
+ end
28
+
15
29
  def stop_service
16
30
  @replay_service.kill
17
31
  end
18
32
 
19
- private
33
+ private
20
34
  def wait_for_replay(timeout)
21
35
  end_time = ::Time.now + timeout
22
36
  until ::Time.now > end_time
@@ -25,4 +39,11 @@ module PinchHitter::Service::Runner
25
39
  end
26
40
  raise 'Timed out waiting for replay service to start'
27
41
  end
42
+
43
+ #Borrowed from https://github.com/watir/watirspec/blob/master/lib/silent_logger.rb
44
+ class SilentLogger
45
+ (::Logger.instance_methods - Object.instance_methods).each do |logger_instance_method|
46
+ define_method(logger_instance_method) { |*args| }
47
+ end
48
+ end
28
49
  end
@@ -1,3 +1,3 @@
1
1
  module PinchHitter
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinch_hitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Jackson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-09 00:00:00.000000000 Z
11
+ date: 2015-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.1.11
193
+ rubygems_version: 2.4.6
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Test utility for mocking out external web responses