Class: Webspicy::Web::Specification::Pre::GlobalRequestHeaders
- Inherits:
-
Object
- Object
- Webspicy::Web::Specification::Pre::GlobalRequestHeaders
- Includes:
- Webspicy::Web::Specification::Pre
- Defined in:
- lib/webspicy/web/specification/pre/global_request_headers.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{}
Constants included from Specification::Condition
Specification::Condition::MATCH_ALL
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Attributes included from Specification::Condition
#matching_description, #tester
Instance Method Summary collapse
-
#initialize(headers, options = {}, &bl) ⇒ GlobalRequestHeaders
constructor
A new instance of GlobalRequestHeaders.
- #instrument ⇒ Object
- #match(service, pre) ⇒ Object
Methods included from Specification::Pre
#contribute_to_openapi_verb, #counterexamples
Methods included from Specification::Condition
#bind, #fail!, match, #sooner_or_later, #to_s
Constructor Details
#initialize(headers, options = {}, &bl) ⇒ GlobalRequestHeaders
Returns a new instance of GlobalRequestHeaders.
10 11 12 13 14 |
# File 'lib/webspicy/web/specification/pre/global_request_headers.rb', line 10 def initialize(headers, = {}, &bl) @headers = headers @options = DEFAULT_OPTIONS.merge() @matcher = bl end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
15 16 17 |
# File 'lib/webspicy/web/specification/pre/global_request_headers.rb', line 15 def headers @headers end |
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
15 16 17 |
# File 'lib/webspicy/web/specification/pre/global_request_headers.rb', line 15 def matcher @matcher end |
Instance Method Details
#instrument ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/webspicy/web/specification/pre/global_request_headers.rb', line 26 def instrument extra = headers.reject{|k| test_case.headers.has_key?(k) } puts "Instrumenting #{test_case.object_id}" test_case.headers.merge!(extra) end |
#match(service, pre) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/webspicy/web/specification/pre/global_request_headers.rb', line 17 def match(service, pre) if matcher return self if matcher.call(service) nil else self end end |