Skip to content

Commit

Permalink
Avoid redundant regex argument
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Mar 1, 2024
1 parent a8f2c24 commit 5902db0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/openapi/minitest_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def run(*args)
result = super
if ENV['OPENAPI'] && self.class.openapi?
file_path = method(name).source_location.first
human_name = name.sub(/^test_/, '').gsub(/_/, ' ')
human_name = name.sub(/^test_/, '').gsub('_', ' ')
example = Example.new(self, human_name, {}, file_path)
path = RSpec::OpenAPI.path.yield_self { |p| p.is_a?(Proc) ? p.call(example) : p }
record = RSpec::OpenAPI::RecordBuilder.build(self, example: example)
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/openapi/record_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def safe_parse_body(response)

def extract_headers(request, response)
request_headers = RSpec::OpenAPI.request_headers.each_with_object([]) do |header, headers_arr|
header_key = header.gsub(/-/, '_').upcase
header_key = header.gsub('-', '_').upcase
header_value = request.get_header(['HTTP', header_key].join('_')) || request.get_header(header_key)
headers_arr << [header, header_value] if header_value
end
Expand Down

0 comments on commit 5902db0

Please sign in to comment.