mock_server 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mock_server/playback.rb +10 -8
  2. metadata +2 -1
@@ -60,19 +60,20 @@ module MockServer
60
60
  }
61
61
 
62
62
  # Filter out matchers by path and method
63
- matchers = @options[:matchers].select { |match|
63
+ matchers = @options[:matchers].select { |match|
64
64
  request[:method].to_s.upcase == match[:method].to_s.upcase and request[:path] == match[:path]
65
65
  }
66
66
 
67
- # Match the request with a record by validating against the matcher if any.
68
- @data.detect { |entry|
69
- recorded_request = Hashie::Mash.new entry[:request]
70
- recorded_response = entry[:response].dup
67
+ data = false
68
+ matchers.detect { |matcher|
69
+ # Match the request with a record by validating against the matcher if any.
70
+ data = @data.detect { |entry|
71
+ recorded_request = Hashie::Mash.new entry[:request]
72
+ recorded_response = entry[:response].dup
71
73
 
72
- recorded_response[:body] = JSON.parse(recorded_response[:body]) rescue recorded_response[:body]
73
- recorded_response = Hashie::Mash.new recorded_response
74
+ recorded_response[:body] = JSON.parse(recorded_response[:body]) rescue recorded_response[:body]
75
+ recorded_response = Hashie::Mash.new recorded_response
74
76
 
75
- matchers.detect { |matcher|
76
77
  if matcher[:matcher]
77
78
  result = true
78
79
  begin
@@ -88,6 +89,7 @@ module MockServer
88
89
  end
89
90
  }
90
91
  }
92
+ data
91
93
  end
92
94
 
93
95
  def store_matcher_exception(exception)
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Charles Barbier
9
9
  - Saimon Moore
10
+ - Ferran Basora
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []