Sha256: 2a811ed2e020f8dd744329a1183ca7618b3fa2fa7599facb0de2343e1477bfb2

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

require 'fitting/records/unit/response'

module Fitting
  class Records
    class Unit
      class Request
        def initialize(documented_request, tested_requests)
          @documented_request = documented_request
          @tested_requests = tested_requests
        end

        def path
          @path ||= @documented_request.path
        end

        def method
          @method ||= @documented_request.method
        end

        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

        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
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
fitting-2.17.0 lib/fitting/records/unit/request.rb
fitting-2.16.1 lib/fitting/records/unit/request.rb
fitting-2.16.0 lib/fitting/records/unit/request.rb
fitting-2.15.0 lib/fitting/records/unit/request.rb
fitting-2.14.1 lib/fitting/records/unit/request.rb
fitting-2.14.0 lib/fitting/records/unit/request.rb
fitting-2.13.1 lib/fitting/records/unit/request.rb
fitting-2.13.0 lib/fitting/records/unit/request.rb
fitting-2.12.1 lib/fitting/records/unit/request.rb
fitting-2.12.0 lib/fitting/records/unit/request.rb
fitting-2.11.0 lib/fitting/records/unit/request.rb
fitting-2.10.0 lib/fitting/records/unit/request.rb
fitting-2.9.1 lib/fitting/records/unit/request.rb
fitting-2.9.0 lib/fitting/records/unit/request.rb
fitting-2.8.1 lib/fitting/records/unit/request.rb
fitting-2.8.0 lib/fitting/records/unit/request.rb
fitting-2.7.2 lib/fitting/records/unit/request.rb
fitting-2.7.1 lib/fitting/records/unit/request.rb
fitting-2.7.0 lib/fitting/records/unit/request.rb
fitting-2.6.0 lib/fitting/records/unit/request.rb