Module: Fictium::RSpec::Autocomplete::Params
- Defined in:
- lib/fictium/rspec/autocomplete/params.rb
Constant Summary collapse
- REQUEST_SECTIONS =
%i[query header path cookie].freeze
- IGNORED_PATH_PARAMETERS =
%i[action controller].freeze
Class Method Summary collapse
Class Method Details
.extract_from_request(action, request) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/fictium/rspec/autocomplete/params.rb', line 13 def extract_from_request(action, request) action.method = request.method.downcase extract_path(action, request) REQUEST_SECTIONS.each do |section| action.params[section] ||= ActiveSupport::HashWithIndifferentAccess.new send(:"parse_request_#{section}", action.params[section], action, request) end end |
.extract_from_response(example, response) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fictium/rspec/autocomplete/params.rb', line 22 def extract_from_response(example, response) example.headers ||= ActiveSupport::HashWithIndifferentAccess.new response.headers.each do |name, value| next unless valid_header?(name) example.headers[name] ||= {} example.headers[name].merge!( example: value ) end end |