http_stub 0.24.3 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http_stub.rb +8 -2
- data/lib/http_stub/server/application/application.rb +16 -4
- data/lib/http_stub/server/request/request.rb +6 -1
- data/lib/http_stub/server/response.rb +5 -3
- data/lib/http_stub/server/scenario/controller.rb +2 -2
- data/lib/http_stub/server/scenario/parser.rb +1 -3
- data/lib/http_stub/server/stub/controller.rb +8 -6
- data/lib/http_stub/server/stub/empty.rb +9 -5
- data/lib/http_stub/server/stub/match/controller.rb +22 -0
- data/lib/http_stub/server/stub/match/{result.rb → match.rb} +9 -1
- data/lib/http_stub/server/stub/match/miss.rb +19 -0
- data/lib/http_stub/server/stub/match/rules.rb +33 -0
- data/lib/http_stub/server/stub/parser.rb +1 -1
- data/lib/http_stub/server/stub/payload.rb +20 -0
- data/lib/http_stub/server/stub/payload/base_uri_modifier.rb +17 -0
- data/lib/http_stub/server/stub/payload/response_body_modifier.rb +19 -0
- data/lib/http_stub/server/stub/response/base.rb +5 -1
- data/lib/http_stub/server/stub/response/file.rb +5 -0
- data/lib/http_stub/server/stub/response/text.rb +4 -0
- data/lib/http_stub/server/stub/stub.rb +8 -18
- data/lib/http_stub/server/stub/triggers.rb +1 -1
- data/lib/http_stub/server/views/_activate_scenario.haml +17 -4
- data/lib/http_stub/server/views/_stub.haml +2 -2
- data/lib/http_stub/server/views/{_match.haml → _stub_match.haml} +1 -1
- data/lib/http_stub/server/views/_stub_miss.haml +3 -0
- data/lib/http_stub/server/views/index.haml +4 -2
- data/lib/http_stub/server/views/stub_matches.haml +4 -0
- data/lib/http_stub/server/views/stub_misses.haml +4 -0
- data/lib/http_stub/version.rb +1 -1
- data/spec/acceptance/stub_match_last_spec.rb +170 -0
- data/spec/acceptance/stub_match_list_spec.rb +115 -0
- data/spec/acceptance/stub_miss_list_spec.rb +58 -0
- data/spec/lib/http_stub/server/application/application_spec.rb +57 -13
- data/spec/lib/http_stub/server/request/request_spec.rb +41 -1
- data/spec/lib/http_stub/server/response_spec.rb +18 -12
- data/spec/lib/http_stub/server/scenario/controller_spec.rb +4 -4
- data/spec/lib/http_stub/server/scenario/parser_spec.rb +30 -27
- data/spec/lib/http_stub/server/stub/controller_spec.rb +45 -26
- data/spec/lib/http_stub/server/stub/empty_spec.rb +14 -14
- data/spec/lib/http_stub/server/stub/match/controller_spec.rb +69 -0
- data/spec/lib/http_stub/server/stub/match/match_spec.rb +146 -0
- data/spec/lib/http_stub/server/stub/match/miss_spec.rb +15 -0
- data/spec/lib/http_stub/server/stub/match/rules_spec.rb +247 -0
- data/spec/lib/http_stub/server/stub/parser_spec.rb +12 -14
- data/spec/lib/http_stub/server/stub/payload/base_uri_modifier_spec.rb +23 -0
- data/spec/lib/http_stub/server/{payload_file_consolidator_spec.rb → stub/payload/response_body_modifier_spec.rb} +22 -14
- data/spec/lib/http_stub/server/stub/payload_spec.rb +33 -0
- data/spec/lib/http_stub/server/stub/response/base_spec.rb +22 -0
- data/spec/lib/http_stub/server/stub/response/file_spec.rb +29 -1
- data/spec/lib/http_stub/server/stub/response/text_spec.rb +18 -0
- data/spec/lib/http_stub/server/stub/stub_spec.rb +48 -145
- data/spec/lib/http_stub/server/stub/triggers_spec.rb +14 -0
- data/spec/spec_helper.rb +7 -3
- data/spec/support/{configurer_integration.rb → http_stub/configurer_integration.rb} +3 -2
- data/spec/support/http_stub/html_view_excluding_request_details.rb +11 -0
- data/spec/support/http_stub/html_view_including_request_details.rb +47 -0
- data/spec/support/http_stub/server/scenario/scenario_fixture.rb +1 -1
- data/spec/support/http_stub/server/stub/match/match_fixture.rb +21 -0
- data/spec/support/http_stub/server/stub/match/miss_fixture.rb +17 -0
- data/spec/support/{server_integration.rb → http_stub/server_integration.rb} +0 -0
- data/spec/support/http_stub/stub_fixture.rb +1 -0
- data/spec/support/http_stub/stub_registrator.rb +83 -0
- metadata +47 -19
- data/lib/http_stub/server/stub/payload_file_consolidator.rb +0 -18
- data/lib/http_stub/server/views/_miss.haml +0 -7
- data/lib/http_stub/server/views/match_results.haml +0 -7
- data/spec/acceptance/stub_match_spec.rb +0 -252
- data/spec/lib/http_stub/server/stub/match/result_spec.rb +0 -33
- data/spec/support/http_stub/server/stub/match/result_fixture.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89ef636d0f034ff2c6ad0966f3becc70899c8ca8
|
4
|
+
data.tar.gz: e2dd710bf4504f1ec6799a4717b0ed493a94a858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c221e672a19916af0902c7a54eccd1cfe58d01f3a6b9ca1be504056079fdc193e09156bbe086634807e72975d5e065c48fa41c7c20d113183181b304736df632
|
7
|
+
data.tar.gz: 2061dd82264cfcba3b0cc3aa177086d1dde71407d32430242530464c3ac1b4de021e71fb7e9b0b6a5c529353aee6d9900baa552546264f03bee0b175af43e896
|
data/lib/http_stub.rb
CHANGED
@@ -16,6 +16,7 @@ require 'active_support/core_ext/string/inflections'
|
|
16
16
|
require 'active_support/core_ext/hash/slice'
|
17
17
|
require 'active_support/core_ext/hash/deep_merge'
|
18
18
|
require 'active_support/core_ext/hash/indifferent_access'
|
19
|
+
require 'active_support/json/encoding'
|
19
20
|
|
20
21
|
require_relative 'http_stub/extensions/core/hash/formatted'
|
21
22
|
require_relative 'http_stub/extensions/core/hash/indifferent_and_insensitive_access'
|
@@ -40,6 +41,7 @@ require_relative 'http_stub/server/stub/match/rule/parameters'
|
|
40
41
|
require_relative 'http_stub/server/stub/match/rule/simple_body'
|
41
42
|
require_relative 'http_stub/server/stub/match/rule/json_body'
|
42
43
|
require_relative 'http_stub/server/stub/match/rule/body'
|
44
|
+
require_relative 'http_stub/server/stub/match/rules'
|
43
45
|
require_relative 'http_stub/server/stub/response/attribute/interpolator/headers'
|
44
46
|
require_relative 'http_stub/server/stub/response/attribute/interpolator/parameters'
|
45
47
|
require_relative 'http_stub/server/stub/response/attribute/interpolator'
|
@@ -51,11 +53,15 @@ require_relative 'http_stub/server/stub/response/file'
|
|
51
53
|
require_relative 'http_stub/server/stub/response'
|
52
54
|
require_relative 'http_stub/server/response'
|
53
55
|
require_relative 'http_stub/server/stub/triggers'
|
54
|
-
require_relative 'http_stub/server/stub/
|
56
|
+
require_relative 'http_stub/server/stub/payload/base_uri_modifier'
|
57
|
+
require_relative 'http_stub/server/stub/payload/response_body_modifier'
|
58
|
+
require_relative 'http_stub/server/stub/payload'
|
55
59
|
require_relative 'http_stub/server/stub/parser'
|
56
60
|
require_relative 'http_stub/server/stub/stub'
|
57
61
|
require_relative 'http_stub/server/stub/empty'
|
58
|
-
require_relative 'http_stub/server/stub/match/
|
62
|
+
require_relative 'http_stub/server/stub/match/match'
|
63
|
+
require_relative 'http_stub/server/stub/match/miss'
|
64
|
+
require_relative 'http_stub/server/stub/match/controller'
|
59
65
|
require_relative 'http_stub/server/stub/registry'
|
60
66
|
require_relative 'http_stub/server/stub/controller'
|
61
67
|
require_relative 'http_stub/server/stub'
|
@@ -23,11 +23,14 @@ module HttpStub
|
|
23
23
|
|
24
24
|
def initialize
|
25
25
|
super()
|
26
|
-
@stub_registry = HttpStub::Server::Stub::Registry.new
|
27
26
|
@scenario_registry = HttpStub::Server::Registry.new("scenario")
|
28
|
-
@
|
29
|
-
@
|
27
|
+
@stub_registry = HttpStub::Server::Stub::Registry.new
|
28
|
+
@stub_match_registry = HttpStub::Server::Registry.new("stub match")
|
29
|
+
@stub_miss_registry = HttpStub::Server::Registry.new("stub miss")
|
30
30
|
@scenario_controller = HttpStub::Server::Scenario::Controller.new(@scenario_registry, @stub_registry)
|
31
|
+
@stub_controller =
|
32
|
+
HttpStub::Server::Stub::Controller.new(@stub_registry, @stub_match_registry, @stub_miss_registry)
|
33
|
+
@stub_match_controller = HttpStub::Server::Stub::Match::Controller.new(@stub_match_registry)
|
31
34
|
end
|
32
35
|
|
33
36
|
before do
|
@@ -66,7 +69,16 @@ module HttpStub
|
|
66
69
|
end
|
67
70
|
|
68
71
|
get "/http_stub/stubs/matches" do
|
69
|
-
haml :
|
72
|
+
haml :stub_matches, {}, matches: @stub_match_registry.all
|
73
|
+
end
|
74
|
+
|
75
|
+
get "/http_stub/stubs/matches/last" do
|
76
|
+
response = @stub_match_controller.find_last(@http_stub_request, logger)
|
77
|
+
@response_pipeline.process(response)
|
78
|
+
end
|
79
|
+
|
80
|
+
get "/http_stub/stubs/misses" do
|
81
|
+
haml :stub_misses, {}, misses: @stub_miss_registry.all
|
70
82
|
end
|
71
83
|
|
72
84
|
get "/http_stub/stubs/:id" do
|
@@ -4,9 +4,10 @@ module HttpStub
|
|
4
4
|
|
5
5
|
class Request
|
6
6
|
|
7
|
-
attr_reader :uri, :method, :headers, :parameters, :body
|
7
|
+
attr_reader :base_uri, :uri, :method, :headers, :parameters, :body
|
8
8
|
|
9
9
|
def initialize(rack_request)
|
10
|
+
@base_uri = rack_request.base_url
|
10
11
|
@uri = rack_request.path_info
|
11
12
|
@method = rack_request.request_method.downcase
|
12
13
|
@headers = HttpStub::Server::Request::Headers.create(rack_request)
|
@@ -14,6 +15,10 @@ module HttpStub
|
|
14
15
|
@body = rack_request.body.read
|
15
16
|
end
|
16
17
|
|
18
|
+
def to_hash
|
19
|
+
{ uri: @uri, method: @method, headers: @headers, parameters: @parameters, body: @body }
|
20
|
+
end
|
21
|
+
|
17
22
|
end
|
18
23
|
|
19
24
|
end
|
@@ -3,11 +3,13 @@ module HttpStub
|
|
3
3
|
|
4
4
|
class Response
|
5
5
|
|
6
|
-
def self.
|
7
|
-
HttpStub::Server::Stub::Response::Text.new(
|
6
|
+
def self.ok(opts={})
|
7
|
+
HttpStub::Server::Stub::Response::Text.new(
|
8
|
+
{ "headers" => {}, "body" => "OK" }.merge(opts).merge("status" => 200)
|
9
|
+
)
|
8
10
|
end
|
9
11
|
|
10
|
-
|
12
|
+
OK = ok.freeze
|
11
13
|
NOT_FOUND = HttpStub::Server::Stub::Response::Text.new("status" => 404, "body" => "NOT FOUND").freeze
|
12
14
|
EMPTY = HttpStub::Server::Stub::Response::Text.new.freeze
|
13
15
|
|
@@ -12,14 +12,14 @@ module HttpStub
|
|
12
12
|
def register(request, logger)
|
13
13
|
scenario = HttpStub::Server::Scenario.create(HttpStub::Server::Scenario::Parser.parse(request))
|
14
14
|
@scenario_registry.add(scenario, logger)
|
15
|
-
HttpStub::Server::Response::
|
15
|
+
HttpStub::Server::Response::OK
|
16
16
|
end
|
17
17
|
|
18
18
|
def activate(name, logger)
|
19
19
|
scenario = @scenario_registry.find(name, logger)
|
20
20
|
if scenario
|
21
21
|
@scenario_activator.activate(scenario, logger)
|
22
|
-
HttpStub::Server::Response::
|
22
|
+
HttpStub::Server::Response::OK
|
23
23
|
else
|
24
24
|
HttpStub::Server::Response::NOT_FOUND
|
25
25
|
end
|
@@ -6,9 +6,7 @@ module HttpStub
|
|
6
6
|
|
7
7
|
def self.parse(request)
|
8
8
|
JSON.parse(request.parameters["payload"]).tap do |payload|
|
9
|
-
payload["stubs"].each
|
10
|
-
HttpStub::Server::Stub::PayloadFileConsolidator.consolidate!(stub_payload, request)
|
11
|
-
end
|
9
|
+
payload["stubs"].each { |stub_payload| HttpStub::Server::Stub::Payload.modify!(stub_payload, request) }
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
@@ -4,26 +4,28 @@ module HttpStub
|
|
4
4
|
|
5
5
|
class Controller
|
6
6
|
|
7
|
-
def initialize(stub_registry,
|
8
|
-
@stub_registry
|
9
|
-
@
|
7
|
+
def initialize(stub_registry, match_registry, miss_registry)
|
8
|
+
@stub_registry = stub_registry
|
9
|
+
@match_registry = match_registry
|
10
|
+
@miss_registry = miss_registry
|
10
11
|
end
|
11
12
|
|
12
13
|
def register(request, logger)
|
13
14
|
stub = HttpStub::Server::Stub.create(HttpStub::Server::Stub::Parser.parse(request))
|
14
15
|
@stub_registry.add(stub, logger)
|
15
|
-
HttpStub::Server::Response.
|
16
|
+
HttpStub::Server::Response.ok("headers" => { "location" => stub.uri })
|
16
17
|
end
|
17
18
|
|
18
19
|
def match(request, logger)
|
19
20
|
stub = @stub_registry.match(request, logger)
|
20
21
|
response = stub ? stub.response_for(request) : HttpStub::Server::Response::NOT_FOUND
|
21
|
-
@
|
22
|
+
@match_registry.add(HttpStub::Server::Stub::Match::Match.new(request, response, stub), logger) if stub
|
23
|
+
@miss_registry.add(HttpStub::Server::Stub::Match::Miss.new(request), logger) unless stub
|
22
24
|
response
|
23
25
|
end
|
24
26
|
|
25
27
|
def clear(logger)
|
26
|
-
[ @stub_registry, @
|
28
|
+
[ @stub_registry, @match_registry, @miss_registry ].each { |registry| registry.clear(logger) }
|
27
29
|
end
|
28
30
|
|
29
31
|
end
|
@@ -7,15 +7,15 @@ module HttpStub
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def initialize
|
10
|
-
@uri
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@
|
10
|
+
@uri = ""
|
11
|
+
@match_rules = HttpStub::Server::Stub::Match::Rules::EMPTY
|
12
|
+
@response = HttpStub::Server::Response::EMPTY
|
13
|
+
@triggers = []
|
14
14
|
end
|
15
15
|
|
16
16
|
public
|
17
17
|
|
18
|
-
attr_reader :uri, :
|
18
|
+
attr_reader :uri, :match_rules, :response, :triggers
|
19
19
|
|
20
20
|
def matches?(_criteria, _logger)
|
21
21
|
false
|
@@ -25,6 +25,10 @@ module HttpStub
|
|
25
25
|
self
|
26
26
|
end
|
27
27
|
|
28
|
+
def to_hash
|
29
|
+
{}
|
30
|
+
end
|
31
|
+
|
28
32
|
def to_s
|
29
33
|
""
|
30
34
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module HttpStub
|
2
|
+
module Server
|
3
|
+
module Stub
|
4
|
+
module Match
|
5
|
+
|
6
|
+
class Controller
|
7
|
+
|
8
|
+
def initialize(result_registry)
|
9
|
+
@result_registry = result_registry
|
10
|
+
end
|
11
|
+
|
12
|
+
def find_last(request, logger)
|
13
|
+
result = @result_registry.find(request.parameters.slice(:method, :uri), logger)
|
14
|
+
result ? HttpStub::Server::Response.ok("body" => result.to_json) : HttpStub::Server::Response::NOT_FOUND
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -3,7 +3,7 @@ module HttpStub
|
|
3
3
|
module Stub
|
4
4
|
module Match
|
5
5
|
|
6
|
-
class
|
6
|
+
class Match
|
7
7
|
|
8
8
|
attr_reader :request, :response, :stub
|
9
9
|
|
@@ -13,6 +13,14 @@ module HttpStub
|
|
13
13
|
@stub = stub
|
14
14
|
end
|
15
15
|
|
16
|
+
def matches?(criteria, _logger)
|
17
|
+
@request.uri.include?(criteria[:uri]) && @request.method.casecmp(criteria[:method]).zero?
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_hash
|
21
|
+
{ request: @request, response: @response, stub: @stub }
|
22
|
+
end
|
23
|
+
|
16
24
|
end
|
17
25
|
|
18
26
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module HttpStub
|
2
|
+
module Server
|
3
|
+
module Stub
|
4
|
+
module Match
|
5
|
+
|
6
|
+
class Rules
|
7
|
+
|
8
|
+
attr_reader :uri, :method, :headers, :parameters, :body
|
9
|
+
|
10
|
+
def initialize(args)
|
11
|
+
@uri = HttpStub::Server::Stub::Match::Rule::Uri.new(args["uri"])
|
12
|
+
@method = HttpStub::Server::Stub::Match::Rule::Method.new(args["method"])
|
13
|
+
@headers = HttpStub::Server::Stub::Match::Rule::Headers.new(args["headers"])
|
14
|
+
@parameters = HttpStub::Server::Stub::Match::Rule::Parameters.new(args["parameters"])
|
15
|
+
@body = HttpStub::Server::Stub::Match::Rule::Body.create(args["body"])
|
16
|
+
end
|
17
|
+
|
18
|
+
EMPTY = self.new("uri" => "", "method" => "", "headers" => {}, "parameters" => {}, "body" => "").freeze
|
19
|
+
|
20
|
+
def matches?(request, logger)
|
21
|
+
[ @uri, @method, @headers, @parameters, @body ].all? { |matcher| matcher.matches?(request, logger) }
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
{ uri: @uri, method: @method, headers: @headers, parameters: @parameters, body: @body }
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module HttpStub
|
2
|
+
module Server
|
3
|
+
module Stub
|
4
|
+
|
5
|
+
module Payload
|
6
|
+
|
7
|
+
MODIFIERS = [ HttpStub::Server::Stub::Payload::BaseUriModifier,
|
8
|
+
HttpStub::Server::Stub::Payload::ResponseBodyModifier ].freeze
|
9
|
+
|
10
|
+
private_constant :MODIFIERS
|
11
|
+
|
12
|
+
def self.modify!(payload, request)
|
13
|
+
payload.tap { MODIFIERS.each { |modifier| modifier.modify!(payload, request) } }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HttpStub
|
2
|
+
module Server
|
3
|
+
module Stub
|
4
|
+
module Payload
|
5
|
+
|
6
|
+
class ResponseBodyModifier
|
7
|
+
|
8
|
+
def self.modify!(payload, request)
|
9
|
+
response_file = request.parameters["response_file_#{payload["id"]}"]
|
10
|
+
payload["response"]["body"] = response_file if response_file
|
11
|
+
payload["triggers"].each { |trigger_payload| modify!(trigger_payload, request) } if payload["triggers"]
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -34,7 +34,7 @@ module HttpStub
|
|
34
34
|
attr_reader :status, :headers, :delay_in_seconds
|
35
35
|
|
36
36
|
def initialize(args={})
|
37
|
-
@original_args
|
37
|
+
@original_args = args
|
38
38
|
resolved_args = self.class.merge_defaults(args)
|
39
39
|
@status = resolved_args["status"]
|
40
40
|
@headers = HttpStub::Server::Stub::Response::Attribute::Headers.new(resolved_args["headers"])
|
@@ -45,6 +45,10 @@ module HttpStub
|
|
45
45
|
self.class.name.demodulize.underscore
|
46
46
|
end
|
47
47
|
|
48
|
+
def to_hash
|
49
|
+
{ status: @status, headers: @headers, delay_in_seconds: @delay_in_seconds }
|
50
|
+
end
|
51
|
+
|
48
52
|
end
|
49
53
|
|
50
54
|
end
|
@@ -4,41 +4,31 @@ module HttpStub
|
|
4
4
|
|
5
5
|
class Stub
|
6
6
|
|
7
|
-
attr_reader :uri, :
|
7
|
+
attr_reader :uri, :match_rules, :response, :triggers
|
8
8
|
|
9
9
|
def initialize(args)
|
10
10
|
@id = args["id"] || SecureRandom.uuid
|
11
|
-
@uri =
|
12
|
-
@
|
13
|
-
@headers = HttpStub::Server::Stub::Match::Rule::Headers.new(args["headers"])
|
14
|
-
@parameters = HttpStub::Server::Stub::Match::Rule::Parameters.new(args["parameters"])
|
15
|
-
@body = HttpStub::Server::Stub::Match::Rule::Body.create(args["body"])
|
11
|
+
@uri = "#{args["base_uri"]}/http_stub/stubs/#{@id}"
|
12
|
+
@match_rules = HttpStub::Server::Stub::Match::Rules.new(args)
|
16
13
|
@response = HttpStub::Server::Stub::Response.create(args["response"])
|
17
14
|
@triggers = HttpStub::Server::Stub::Triggers.new(args["triggers"])
|
18
|
-
@stub_uri = "/http_stub/stubs/#{@id}"
|
19
15
|
@description = args.to_s
|
20
16
|
end
|
21
17
|
|
22
18
|
def matches?(criteria, logger)
|
23
|
-
criteria.is_a?(String) ?
|
19
|
+
criteria.is_a?(String) ? criteria == @id : @match_rules.matches?(criteria, logger)
|
24
20
|
end
|
25
21
|
|
26
22
|
def response_for(request)
|
27
23
|
@response.with_values_from(request)
|
28
24
|
end
|
29
25
|
|
30
|
-
def
|
31
|
-
@
|
26
|
+
def to_hash
|
27
|
+
{ id: @id, uri: @uri, match_rules: @match_rules, response: @response, triggers: @triggers }
|
32
28
|
end
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
def matches_by_id?(criteria)
|
37
|
-
criteria == @id
|
38
|
-
end
|
39
|
-
|
40
|
-
def matches_by_rules?(request, logger)
|
41
|
-
[ @uri, @method, @headers, @parameters, @body ].all? { |matcher| matcher.matches?(request, logger) }
|
30
|
+
def to_s
|
31
|
+
@description
|
42
32
|
end
|
43
33
|
|
44
34
|
end
|