lib/fitting/records/tested/request.rb in fitting-2.18.3 vs lib/fitting/records/tested/request.rb in fitting-3.0.0
- old
+ new
@@ -4,44 +4,44 @@
module Fitting
class Records
class Tested
class Request
- def initialize(env_response, metadata)
- @env_response = env_response
- @metadata = metadata
+ def initialize(response, example)
+ @example = example
+ @response = response
end
def method
- @method ||= @env_response.request.request_method
+ @method ||= @response.request.request_method
end
def path
- @path ||= Tomograph::Path.new(@env_response.request.env['PATH_INFO'] || @env_response.request.fullpath)
+ @path ||= Tomograph::Path.new(@response.request.fullpath)
end
def body
- @body ||= @env_response.request.env['action_dispatch.request.request_parameters']
+ @body ||= @response.request.request_parameters
end
- def response
- @response ||= Fitting::Records::Tested::Response.new(@env_response)
+ def fitting_response
+ @fitting_response ||= Fitting::Records::Tested::Response.new(@response)
end
def test_path
- @test_path ||= @metadata.fetch(:location)
+ @test_path ||= @example.location
end
def test_file_path
- @test_file_path ||= @metadata.fetch(:file_path)
+ @test_file_path ||= @example.file_path
end
def to_spherical
Fitting::Records::Spherical::Request.new(
method: method,
path: path,
body: body,
- response: response.to_spherical,
+ response: fitting_response.to_spherical,
title: test_path,
group: test_file_path
)
end
end