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 +4 -4
- data/.travis.yml +2 -2
- data/Changelog +4 -0
- data/LICENSE +2 -2
- data/lib/pinch_hitter/service/runner.rb +23 -2
- data/lib/pinch_hitter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 088d1d1c1d4f9b7dbfbefcd5e1edcbcbe7b469f6
|
4
|
+
data.tar.gz: 8eaf85f09bb6659b41c0aba77d6e11a618cffeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f477896752ca0759216d711d2229b38e98a52b3369a2b37ac22c42c0b5540f27e45d1a5416aff655e52137b6ebbc48318b19f1bab24cb0ac12a38064bbd7451a
|
7
|
+
data.tar.gz: 53778f0cac8e04f3cf1e5cd4d74c2022b0e012b7264deb86810dda0f7f64eb33971d40a79452023d9e374b220d53ef660697541ff51f69cd5dcc598963b66549
|
data/.travis.yml
CHANGED
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)
|
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,
|
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
|
data/lib/pinch_hitter/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|