Class: Fitting::Records::Unit::Request
- Inherits:
-
Object
- Object
- Fitting::Records::Unit::Request
- Defined in:
- lib/fitting/records/unit/request.rb
Instance Method Summary collapse
-
#initialize(documented_request, tested_requests) ⇒ Request
constructor
A new instance of Request.
- #method ⇒ Object
- #path ⇒ Object
- #responses ⇒ Object
- #tested_responses ⇒ Object
Constructor Details
#initialize(documented_request, tested_requests) ⇒ Request
Returns a new instance of Request.
7 8 9 10 |
# File 'lib/fitting/records/unit/request.rb', line 7 def initialize(documented_request, tested_requests) @documented_request = documented_request @tested_requests = tested_requests end |
Instance Method Details
#method ⇒ Object
16 17 18 |
# File 'lib/fitting/records/unit/request.rb', line 16 def method @method ||= @documented_request.method end |
#path ⇒ Object
12 13 14 |
# File 'lib/fitting/records/unit/request.rb', line 12 def path @path ||= @documented_request.path end |
#responses ⇒ Object
20 21 22 23 24 |
# File 'lib/fitting/records/unit/request.rb', line 20 def responses @responses ||= @documented_request.responses.to_a.inject([]) do |res, documented_response| res.push(Fitting::Records::Unit::Response.new(documented_response, tested_responses)) end end |
#tested_responses ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/fitting/records/unit/request.rb', line 26 def tested_responses @tested_responses ||= @tested_requests.to_a.inject([]) do |res, tested_request| next res unless @documented_request.method == tested_request.method && @documented_request.path.match(tested_request.path.to_s) res.push(tested_request.response) end end |