mock_server 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mock_server/playback.rb +7 -2
- metadata +5 -5
data/lib/mock_server/playback.rb
CHANGED
@@ -66,13 +66,18 @@ module MockServer
|
|
66
66
|
|
67
67
|
# Match the request with a record by validating against the matcher if any.
|
68
68
|
@data.detect { |entry|
|
69
|
-
recorded_request
|
69
|
+
recorded_request = Hashie::Mash.new entry[:request]
|
70
|
+
|
71
|
+
body = JSON.parse(entry[:response][:body]) rescue nil
|
72
|
+
entry[:response][:body] if body
|
73
|
+
|
74
|
+
recorded_response = Hashie::Mash.new entry[:response]
|
70
75
|
|
71
76
|
matchers.detect { |matcher|
|
72
77
|
if matcher[:matcher]
|
73
78
|
result = true
|
74
79
|
begin
|
75
|
-
matcher[:matcher].call(request, recorded_request)
|
80
|
+
matcher[:matcher].call(request, recorded_request, recorded_response)
|
76
81
|
rescue => matcher_err
|
77
82
|
store_matcher_exception(matcher_err)
|
78
83
|
result = false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2011-11-21 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
17
|
-
requirement: &
|
17
|
+
requirement: &70272738877320 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70272738877320
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: hashie
|
28
|
-
requirement: &
|
28
|
+
requirement: &70272738876860 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70272738876860
|
37
37
|
description:
|
38
38
|
email: unixcharles@gmail.com
|
39
39
|
executables: []
|