Sha256: 58c0328fcde71bc0b768d8c0d3a1f1bcead48dd7568828743ae74124dd378756

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require 'tomograph/path'
require 'fitting/records/tested/response'
require 'fitting/records/spherical/request'

module Fitting
  class Records
    class Tested
      class Request
        def initialize(response, example)
          @example = example
          @response = response
        end

        def method
          @method ||= @response.request.request_method
        end

        def path
          @path ||= Tomograph::Path.new(@response.request.fullpath)
        end

        def body
          @body ||= @response.request.request_parameters
        end

        def fitting_response
          @fitting_response ||= Fitting::Records::Tested::Response.new(@response)
        end

        def test_path
          @test_path ||= @example.location
        end

        def test_file_path
          @test_file_path ||= @example.file_path
        end

        def to_spherical
          Fitting::Records::Spherical::Request.new(
            method: method,
            path: path,
            body: body,
            response: fitting_response.to_spherical,
            title: test_path,
            group: test_file_path
          )
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fitting-3.0.2 lib/fitting/records/tested/request.rb
fitting-3.0.1 lib/fitting/records/tested/request.rb
fitting-3.0.0 lib/fitting/records/tested/request.rb