Skip to content

Commit 722eb7c

Browse files
authored
Avoid redundant regex argument (#180)
1 parent 05d6b5f commit 722eb7c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rspec/openapi/minitest_hooks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def run(*args)
1010
result = super
1111
if ENV['OPENAPI'] && self.class.openapi?
1212
file_path = method(name).source_location.first
13-
human_name = name.sub(/^test_/, '').gsub(/_/, ' ')
13+
human_name = name.sub(/^test_/, '').gsub('_', ' ')
1414
example = Example.new(self, human_name, {}, file_path)
1515
path = RSpec::OpenAPI.path.yield_self { |p| p.is_a?(Proc) ? p.call(example) : p }
1616
record = RSpec::OpenAPI::RecordBuilder.build(self, example: example)

lib/rspec/openapi/record_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def safe_parse_body(response)
4848

4949
def extract_headers(request, response)
5050
request_headers = RSpec::OpenAPI.request_headers.each_with_object([]) do |header, headers_arr|
51-
header_key = header.gsub(/-/, '_').upcase
51+
header_key = header.gsub('-', '_').upcase
5252
header_value = request.get_header(['HTTP', header_key].join('_')) || request.get_header(header_key)
5353
headers_arr << [header, header_value] if header_value
5454
end

0 commit comments

Comments
 (0)