http_stub 0.15.5 → 0.16.0.pre1
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 +37 -27
- data/lib/http_stub/configurer.rb +2 -2
- data/lib/http_stub/configurer/dsl/deprecated.rb +60 -0
- data/lib/http_stub/configurer/{server/dsl.rb → dsl/sanctioned.rb} +18 -18
- data/lib/http_stub/configurer/dsl/scenario_activator.rb +15 -0
- data/lib/http_stub/configurer/dsl/scenario_builder.rb +37 -0
- data/lib/http_stub/configurer/dsl/stub_activator_builder.rb +24 -0
- data/lib/http_stub/configurer/{request → dsl}/stub_builder.rb +4 -3
- data/lib/http_stub/configurer/dsl/stub_builder_producer.rb +21 -0
- data/lib/http_stub/configurer/request/http/factory.rb +8 -2
- data/lib/http_stub/configurer/request/scenario.rb +29 -0
- data/lib/http_stub/configurer/server/facade.rb +7 -7
- data/lib/http_stub/server/application.rb +21 -14
- data/lib/http_stub/server/registry.rb +7 -3
- data/lib/http_stub/server/response.rb +3 -3
- data/lib/http_stub/server/scenario.rb +12 -0
- data/lib/http_stub/server/scenario/activator.rb +25 -0
- data/lib/http_stub/server/scenario/controller.rb +36 -0
- data/lib/http_stub/server/scenario/instance.rb +36 -0
- data/lib/http_stub/server/scenario/request_parser.rb +19 -0
- data/lib/http_stub/server/stub.rb +3 -23
- data/lib/http_stub/server/stub/controller.rb +30 -0
- data/lib/http_stub/server/stub/exact_value_matcher.rb +15 -0
- data/lib/http_stub/server/stub/hash_with_string_value_matchers.rb +22 -0
- data/lib/http_stub/server/stub/headers.rb +19 -0
- data/lib/http_stub/server/stub/instance.rb +31 -0
- data/lib/http_stub/server/stub/method.rb +23 -0
- data/lib/http_stub/server/stub/omitted_value_matcher.rb +21 -0
- data/lib/http_stub/server/stub/payload_file_consolidator.rb +18 -0
- data/lib/http_stub/server/stub/regexp_value_matcher.rb +16 -0
- data/lib/http_stub/server/stub/registry.rb +31 -0
- data/lib/http_stub/server/stub/request_header_parser.rb +19 -0
- data/lib/http_stub/server/stub/request_headers.rb +28 -0
- data/lib/http_stub/server/stub/request_parameters.rb +23 -0
- data/lib/http_stub/server/stub/request_parser.rb +17 -0
- data/lib/http_stub/server/stub/response.rb +16 -0
- data/lib/http_stub/server/stub/response/base.rb +64 -0
- data/lib/http_stub/server/stub/response/file.rb +36 -0
- data/lib/http_stub/server/stub/response/text.rb +19 -0
- data/lib/http_stub/server/stub/string_value_matcher.rb +31 -0
- data/lib/http_stub/server/stub/triggers.rb +25 -0
- data/lib/http_stub/server/stub/uri.rb +23 -0
- data/lib/http_stub/server/views/_scenario.haml +16 -0
- data/lib/http_stub/server/views/application.sass +4 -0
- data/lib/http_stub/server/views/scenarios.haml +3 -0
- data/lib/http_stub/version.rb +1 -1
- data/spec/acceptance/activator_spec.rb +81 -0
- data/spec/acceptance/configurer_initialization_spec.rb +158 -0
- data/spec/acceptance/scenario_spec.rb +91 -0
- data/spec/acceptance/stub_control_values_spec.rb +160 -0
- data/spec/acceptance/stub_spec.rb +290 -0
- data/spec/acceptance/stub_trigger_spec.rb +144 -0
- data/spec/lib/http_stub/configurer/{deprecated_dsl_spec.rb → dsl/deprecated_spec.rb} +21 -13
- data/spec/lib/http_stub/configurer/{server/dsl_spec.rb → dsl/sanctioned_spec.rb} +74 -97
- data/spec/lib/http_stub/configurer/dsl/scenario_activator_spec.rb +62 -0
- data/spec/lib/http_stub/configurer/dsl/scenario_builder_spec.rb +146 -0
- data/spec/lib/http_stub/configurer/dsl/stub_activator_builder_spec.rb +120 -0
- data/spec/lib/http_stub/configurer/dsl/stub_builder_producer_spec.rb +105 -0
- data/spec/lib/http_stub/configurer/{request → dsl}/stub_builder_spec.rb +33 -5
- data/spec/lib/http_stub/configurer/request/controllable_value_spec.rb +1 -1
- data/spec/lib/http_stub/configurer/request/http/factory_spec.rb +46 -5
- data/spec/lib/http_stub/configurer/request/omittable_spec.rb +1 -1
- data/spec/lib/http_stub/configurer/request/scenario_spec.rb +69 -0
- data/spec/lib/http_stub/configurer/request/stub_spec.rb +2 -2
- data/spec/lib/http_stub/configurer/server/facade_spec.rb +17 -17
- data/spec/lib/http_stub/configurer_spec.rb +1 -1
- data/spec/lib/http_stub/server/application_integration_spec.rb +23 -13
- data/spec/lib/http_stub/server/application_spec.rb +40 -38
- data/spec/lib/http_stub/server/daemon_spec.rb +2 -2
- data/spec/lib/http_stub/server/registry_spec.rb +66 -17
- data/spec/lib/http_stub/server/{request_parser_spec.rb → request_file_consolidator_spec.rb} +20 -33
- data/spec/lib/http_stub/server/response_pipeline_spec.rb +1 -1
- data/spec/lib/http_stub/server/scenario/activator_spec.rb +106 -0
- data/spec/lib/http_stub/server/scenario/controller_spec.rb +102 -0
- data/spec/lib/http_stub/server/scenario/instance_spec.rb +126 -0
- data/spec/lib/http_stub/server/scenario/request_parser_spec.rb +59 -0
- data/spec/lib/http_stub/server/scenario_spec.rb +24 -0
- data/spec/lib/http_stub/server/{stub_controller_spec.rb → stub/controller_spec.rb} +13 -17
- data/spec/lib/http_stub/server/{exact_value_matcher_spec.rb → stub/exact_value_matcher_spec.rb} +3 -3
- data/spec/lib/http_stub/server/{hash_with_string_value_matchers_spec.rb → stub/hash_with_string_value_matchers_spec.rb} +7 -5
- data/spec/lib/http_stub/server/{headers_spec.rb → stub/headers_spec.rb} +2 -2
- data/spec/lib/http_stub/server/stub/instance_spec.rb +201 -0
- data/spec/lib/http_stub/server/stub/method_spec.rb +95 -0
- data/spec/lib/http_stub/server/{omitted_value_matcher_spec.rb → stub/omitted_value_matcher_spec.rb} +3 -3
- data/spec/lib/http_stub/server/{regexp_value_matcher_spec.rb → stub/regexp_value_matcher_spec.rb} +3 -3
- data/spec/lib/http_stub/server/stub/registry_integration_spec.rb +56 -0
- data/spec/lib/http_stub/server/{stub_registry_spec.rb → stub/registry_spec.rb} +27 -14
- data/spec/lib/http_stub/server/{request_header_parser_spec.rb → stub/request_header_parser_spec.rb} +6 -6
- data/spec/lib/http_stub/server/stub/request_headers_spec.rb +68 -0
- data/spec/lib/http_stub/server/{stub_parameters_spec.rb → stub/request_parameters_spec.rb} +19 -17
- data/spec/lib/http_stub/server/stub/request_parser_spec.rb +56 -0
- data/spec/lib/http_stub/server/{stub_response → stub/response}/base_spec.rb +5 -5
- data/spec/lib/http_stub/server/{stub_response → stub/response}/file_spec.rb +3 -3
- data/spec/lib/http_stub/server/{stub_response → stub/response}/text_spec.rb +3 -3
- data/spec/lib/http_stub/server/{stub_response_spec.rb → stub/response_spec.rb} +8 -8
- data/spec/lib/http_stub/server/{string_value_matcher_spec.rb → stub/string_value_matcher_spec.rb} +25 -13
- data/spec/lib/http_stub/server/{stub_triggers_spec.rb → stub/triggers_spec.rb} +7 -9
- data/spec/lib/http_stub/server/stub/uri_spec.rb +43 -0
- data/spec/lib/http_stub/server/stub_spec.rb +10 -185
- data/spec/spec_helper.rb +10 -5
- data/spec/support/configurer_integration.rb +24 -0
- data/spec/support/scenario_fixture.rb +33 -0
- data/spec/support/stub_fixture.rb +1 -1
- metadata +126 -84
- data/lib/http_stub/configurer/deprecated_dsl.rb +0 -57
- data/lib/http_stub/configurer/request/stub_activator.rb +0 -26
- data/lib/http_stub/configurer/request/stub_activator_builder.rb +0 -25
- data/lib/http_stub/server/exact_value_matcher.rb +0 -13
- data/lib/http_stub/server/hash_with_string_value_matchers.rb +0 -20
- data/lib/http_stub/server/headers.rb +0 -17
- data/lib/http_stub/server/omitted_value_matcher.rb +0 -19
- data/lib/http_stub/server/regexp_value_matcher.rb +0 -14
- data/lib/http_stub/server/request_header_parser.rb +0 -17
- data/lib/http_stub/server/request_parser.rb +0 -29
- data/lib/http_stub/server/string_value_matcher.rb +0 -29
- data/lib/http_stub/server/stub_activator.rb +0 -30
- data/lib/http_stub/server/stub_activator_controller.rb +0 -34
- data/lib/http_stub/server/stub_controller.rb +0 -28
- data/lib/http_stub/server/stub_headers.rb +0 -24
- data/lib/http_stub/server/stub_parameters.rb +0 -21
- data/lib/http_stub/server/stub_registry.rb +0 -29
- data/lib/http_stub/server/stub_response.rb +0 -14
- data/lib/http_stub/server/stub_response/base.rb +0 -62
- data/lib/http_stub/server/stub_response/file.rb +0 -34
- data/lib/http_stub/server/stub_response/text.rb +0 -17
- data/lib/http_stub/server/stub_triggers.rb +0 -23
- data/lib/http_stub/server/stub_uri.rb +0 -21
- data/lib/http_stub/server/views/stub_activators.haml +0 -6
- data/spec/lib/http_stub/configurer/request/stub_activator_builder_spec.rb +0 -119
- data/spec/lib/http_stub/configurer/request/stub_activator_spec.rb +0 -45
- data/spec/lib/http_stub/configurer_integration_spec.rb +0 -837
- data/spec/lib/http_stub/server/stub_activator_controller_spec.rb +0 -95
- data/spec/lib/http_stub/server/stub_activator_spec.rb +0 -83
- data/spec/lib/http_stub/server/stub_headers_spec.rb +0 -68
- data/spec/lib/http_stub/server/stub_registry_integration_spec.rb +0 -62
- data/spec/lib/http_stub/server/stub_uri_spec.rb +0 -42
@@ -1,26 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Configurer
|
3
|
-
module Request
|
4
|
-
|
5
|
-
class StubActivator
|
6
|
-
|
7
|
-
delegate :response_files, to: :@stub
|
8
|
-
|
9
|
-
def initialize(args)
|
10
|
-
@activation_uri = args[:activation_uri]
|
11
|
-
@stub = args[:stub]
|
12
|
-
end
|
13
|
-
|
14
|
-
def payload
|
15
|
-
{ activation_uri: @activation_uri }.merge(@stub.payload)
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
@activation_uri
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Configurer
|
3
|
-
module Request
|
4
|
-
|
5
|
-
class StubActivatorBuilder
|
6
|
-
|
7
|
-
delegate :match_requests, :respond_with, :trigger, to: :@stub_builder
|
8
|
-
|
9
|
-
def initialize(response_defaults)
|
10
|
-
@stub_builder = HttpStub::Configurer::Request::StubBuilder.new(response_defaults)
|
11
|
-
end
|
12
|
-
|
13
|
-
def on(uri)
|
14
|
-
@activation_uri = uri
|
15
|
-
end
|
16
|
-
|
17
|
-
def build
|
18
|
-
HttpStub::Configurer::Request::StubActivator.new(activation_uri: @activation_uri, stub: @stub_builder.build)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class HashWithStringValueMatchers < Hash
|
5
|
-
|
6
|
-
def initialize(stub_hash)
|
7
|
-
stub_hash.each_pair { |key, value| self[key] = HttpStub::Server::StringValueMatcher.new(value) }
|
8
|
-
end
|
9
|
-
|
10
|
-
def match?(actual_hash)
|
11
|
-
!(self.find do |key_and_value_matcher|
|
12
|
-
key, value_matcher = key_and_value_matcher
|
13
|
-
!value_matcher.match?(actual_hash[key])
|
14
|
-
end)
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class OmittedValueMatcher
|
5
|
-
|
6
|
-
private
|
7
|
-
|
8
|
-
OMITTED_CONTROL_VALUE = "control:omitted".freeze
|
9
|
-
|
10
|
-
public
|
11
|
-
|
12
|
-
def self.match?(stub_value, actual_value)
|
13
|
-
stub_value == OMITTED_CONTROL_VALUE && actual_value.nil?
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class RequestHeaderParser
|
5
|
-
|
6
|
-
def self.parse(request)
|
7
|
-
request.env.reduce({}) do |result, element|
|
8
|
-
match = element[0].match(/^(?:HTTP_)?([A-Z0-9_]+)$/)
|
9
|
-
result[match[1]] = element[1] if match
|
10
|
-
result
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class RequestParser
|
5
|
-
|
6
|
-
class << self
|
7
|
-
|
8
|
-
def parse(request)
|
9
|
-
JSON.parse(request.params["payload"] || request.body.read).tap do |payload|
|
10
|
-
consolidate_files_into_payload(payload, request)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def consolidate_files_into_payload(payload, request)
|
17
|
-
response_file = request.params["response_file_#{payload["id"]}"]
|
18
|
-
payload["response"]["body"] = response_file if response_file
|
19
|
-
payload["triggers"].each do |trigger_payload|
|
20
|
-
consolidate_files_into_payload(trigger_payload, request)
|
21
|
-
end if payload["triggers"]
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StringValueMatcher
|
5
|
-
|
6
|
-
private
|
7
|
-
|
8
|
-
MATCHERS = [ HttpStub::Server::OmittedValueMatcher,
|
9
|
-
HttpStub::Server::RegexpValueMatcher,
|
10
|
-
HttpStub::Server::ExactValueMatcher ].freeze
|
11
|
-
|
12
|
-
public
|
13
|
-
|
14
|
-
def initialize(stub_value)
|
15
|
-
@stub_match_value = stub_value ? stub_value.to_s : stub_value
|
16
|
-
end
|
17
|
-
|
18
|
-
def match?(actual_value)
|
19
|
-
!!MATCHERS.find { |matcher| matcher.match?(@stub_match_value, actual_value) }
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_s
|
23
|
-
@stub_match_value
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StubActivator
|
5
|
-
|
6
|
-
def initialize(args)
|
7
|
-
@args = args
|
8
|
-
@stub = HttpStub::Server::Stub.new(args)
|
9
|
-
end
|
10
|
-
|
11
|
-
def satisfies?(request)
|
12
|
-
activation_uri == request.path_info
|
13
|
-
end
|
14
|
-
|
15
|
-
def the_stub
|
16
|
-
@stub
|
17
|
-
end
|
18
|
-
|
19
|
-
def activation_uri
|
20
|
-
@args["activation_uri"]
|
21
|
-
end
|
22
|
-
|
23
|
-
def to_s
|
24
|
-
@args.to_s
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StubActivatorController
|
5
|
-
|
6
|
-
def initialize(stub_activator_registry, stub_registry)
|
7
|
-
@stub_activator_registry = stub_activator_registry
|
8
|
-
@stub_registry = stub_registry
|
9
|
-
end
|
10
|
-
|
11
|
-
def register(request)
|
12
|
-
stub_activator = HttpStub::Server::StubActivator.new(HttpStub::Server::RequestParser.parse(request))
|
13
|
-
@stub_activator_registry.add(stub_activator, request)
|
14
|
-
HttpStub::Server::Response::SUCCESS
|
15
|
-
end
|
16
|
-
|
17
|
-
def activate(request)
|
18
|
-
activator = @stub_activator_registry.find_for(request)
|
19
|
-
if activator
|
20
|
-
@stub_registry.add(activator.the_stub, request)
|
21
|
-
HttpStub::Server::Response::SUCCESS
|
22
|
-
else
|
23
|
-
HttpStub::Server::Response::EMPTY
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def clear(request)
|
28
|
-
@stub_activator_registry.clear(request)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StubController
|
5
|
-
|
6
|
-
def initialize(registry)
|
7
|
-
@registry = registry
|
8
|
-
end
|
9
|
-
|
10
|
-
def register(request)
|
11
|
-
stub = HttpStub::Server::Stub.new(HttpStub::Server::RequestParser.parse(request))
|
12
|
-
@registry.add(stub, request)
|
13
|
-
HttpStub::Server::Response::SUCCESS
|
14
|
-
end
|
15
|
-
|
16
|
-
def replay(request)
|
17
|
-
stub = @registry.find_for(request)
|
18
|
-
stub ? stub.response : HttpStub::Server::Response::EMPTY
|
19
|
-
end
|
20
|
-
|
21
|
-
def clear(request)
|
22
|
-
@registry.clear(request)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StubHeaders < HttpStub::Server::Headers
|
5
|
-
|
6
|
-
def initialize(headers)
|
7
|
-
super(headers)
|
8
|
-
@headers = HttpStub::Server::HashWithStringValueMatchers.new((headers || {}).downcase_and_underscore_keys)
|
9
|
-
end
|
10
|
-
|
11
|
-
def match?(request)
|
12
|
-
@headers.match?(headers_in(request).downcase_and_underscore_keys)
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def headers_in(request)
|
18
|
-
HttpStub::Server::RequestHeaderParser.parse(request)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StubParameters
|
5
|
-
|
6
|
-
def initialize(parameters)
|
7
|
-
@parameters = HttpStub::Server::HashWithStringValueMatchers.new(parameters || {})
|
8
|
-
end
|
9
|
-
|
10
|
-
def match?(request)
|
11
|
-
@parameters.match?(request.params)
|
12
|
-
end
|
13
|
-
|
14
|
-
def to_s
|
15
|
-
@parameters ? @parameters.map { |key_and_value| key_and_value.map(&:to_s).join("=") }.join("&") : ""
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class StubRegistry
|
5
|
-
|
6
|
-
delegate :add, :all, :clear, to: :@registry
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@registry = HttpStub::Server::Registry.new("stub")
|
10
|
-
end
|
11
|
-
|
12
|
-
def find_for(request)
|
13
|
-
stub = @registry.find_for(request)
|
14
|
-
stub.triggers.add_to(self, request) if stub
|
15
|
-
stub
|
16
|
-
end
|
17
|
-
|
18
|
-
def remember
|
19
|
-
@remembered_stub = @registry.last
|
20
|
-
end
|
21
|
-
|
22
|
-
def recall
|
23
|
-
@registry.rollback_to(@remembered_stub) if @remembered_stub
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
module StubResponse
|
4
|
-
|
5
|
-
class Base
|
6
|
-
|
7
|
-
private
|
8
|
-
|
9
|
-
DEFAULT_ARGS = { "status" => 200, "delay_in_seconds" => 0 }.freeze
|
10
|
-
|
11
|
-
public
|
12
|
-
|
13
|
-
class << self
|
14
|
-
|
15
|
-
def add_default_headers(headers)
|
16
|
-
default_headers.merge!(headers)
|
17
|
-
end
|
18
|
-
|
19
|
-
def merge_defaults(args)
|
20
|
-
args.clone.tap do |result|
|
21
|
-
headers = result["headers"] ||= {}
|
22
|
-
DEFAULT_ARGS.each { |key, value| result[key] = value if !result[key] || result[key] == "" }
|
23
|
-
default_headers.each { |key, value| headers[key] = value if !headers[key] || headers[key] == "" }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def default_headers
|
30
|
-
@default_headers ||= {}
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
attr_reader :status, :body, :delay_in_seconds, :headers
|
36
|
-
|
37
|
-
def initialize(args={})
|
38
|
-
@original_args = args
|
39
|
-
resolved_args = self.class.merge_defaults(args)
|
40
|
-
@status = resolved_args["status"]
|
41
|
-
@body = resolved_args["body"]
|
42
|
-
@delay_in_seconds = resolved_args["delay_in_seconds"]
|
43
|
-
@headers = HttpStub::Server::Headers.new(resolved_args["headers"])
|
44
|
-
end
|
45
|
-
|
46
|
-
def empty?
|
47
|
-
@original_args.empty?
|
48
|
-
end
|
49
|
-
|
50
|
-
def type
|
51
|
-
self.class.name.demodulize.underscore
|
52
|
-
end
|
53
|
-
|
54
|
-
def to_s
|
55
|
-
@original_args.to_s
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|