Skip to content

Commit da374ef

Browse files
committed
Switch mutant operators from light to full and kill surviving mutants
1 parent b494e2c commit da374ef

16 files changed

Lines changed: 59 additions & 22 deletions

File tree

.mutant.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ requires:
1414
- http
1515

1616
mutation:
17+
operators: full
1718
timeout: 10.0
1819

1920
matcher:

lib/http/features/caching.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def around_request(request)
7070

7171
response = yield(add_conditional_headers(request, entry))
7272

73-
return revalidate_entry(entry, response, request) if response.code == 304
73+
return revalidate_entry(entry, response, request) if response.status.not_modified?
7474

7575
response
7676
end

lib/http/features/logging.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def wrap_response(response)
104104
# @raise [ArgumentError] if the formatter is not a valid option
105105
# @api private
106106
def validate_binary_formatter!(formatter)
107-
return formatter if formatter == :stats || formatter == :base64 || formatter.respond_to?(:call)
107+
return formatter if formatter.eql?(:stats) || formatter.eql?(:base64) || formatter.respond_to?(:call)
108108

109109
raise ArgumentError,
110110
"binary_formatter must be :stats, :base64, or a callable " \
@@ -118,7 +118,7 @@ def log_request_details(request)
118118
headers = stringify_headers(request.headers)
119119
if request.body.loggable?
120120
source = request.body.source
121-
body = source.encoding == Encoding::BINARY ? format_binary(source) : source
121+
body = source.encoding.eql?(Encoding::BINARY) ? format_binary(source) : source
122122
logger.debug { "#{headers}\n\n#{body}" }
123123
else
124124
logger.debug { headers }
@@ -131,7 +131,7 @@ def log_request_details(request)
131131
def log_response_body_inline(response)
132132
body = response.body
133133
headers = stringify_headers(response.headers)
134-
if body.respond_to?(:encoding) && body.encoding == Encoding::BINARY
134+
if body.respond_to?(:encoding) && body.encoding.eql?(Encoding::BINARY)
135135
logger.debug { "#{headers}\n\n#{format_binary(body)}" } # steep:ignore
136136
else
137137
logger.debug { "#{headers}\n\n#{body}" }

lib/http/headers.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def set(name, value)
104104
# @api public
105105
def delete(name)
106106
name = normalize_header name
107-
@pile.delete_if { |k, _| k == name }
107+
@pile.delete_if { |k, _| k.eql?(name) }
108108
end
109109

110110
# Appends header value(s) to the given name
@@ -143,7 +143,7 @@ def add(name, value)
143143
# @api public
144144
def get(name)
145145
name = normalize_header name
146-
@pile.select { |k, _| k == name }.map { |_, _, v| v }
146+
@pile.select { |k, _| k.eql?(name) }.map { |_, _, v| v }
147147
end
148148

149149
# Smart version of {#get}
@@ -159,7 +159,9 @@ def [](name)
159159
values = get(name)
160160
return if values.empty?
161161

162-
values.one? ? values.first : values
162+
return values unless values.one?
163+
164+
values.join
163165
end
164166

165167
# Tells whether header with given name is set
@@ -171,7 +173,7 @@ def [](name)
171173
# @api public
172174
def include?(name)
173175
name = normalize_header name
174-
@pile.any? { |k, _| k == name }
176+
@pile.any? { |k, _| k.eql?(name) }
175177
end
176178

177179
# Returns Rack-compatible headers Hash
@@ -232,7 +234,7 @@ def keys
232234
def ==(other)
233235
return false unless other.respond_to? :to_a
234236

235-
to_a == other.to_a
237+
to_a.eql?(other.to_a)
236238
end
237239

238240
# Calls the given block once for each key/value pair

lib/http/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def feature(name)
221221
def assign_options(env)
222222
self.class.defined_options.each do |name|
223223
value = env.local_variable_get(name)
224-
value = Headers.coerce(value) if name == :headers
224+
value = Headers.coerce(value) if name.eql?(:headers)
225225
__send__(:"#{name}=", value)
226226
end
227227
end

lib/http/options/definitions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def validate_base_uri_and_persistent!
178178
base = @base_uri
179179
persistent = @persistent
180180
return unless base && persistent
181-
return if base.origin == persistent
181+
return if base.origin.eql?(persistent)
182182

183183
argument_error!(
184184
format("Persistence origin (%s) conflicts with base URI origin (%s)",

lib/http/redirector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def redirect_to(uri)
149149
verb = :get
150150
end
151151

152-
verb = :get if !SEE_OTHER_ALLOWED_VERBS.include?(verb) && 303 == code
152+
verb = :get if !SEE_OTHER_ALLOWED_VERBS.include?(verb) && code.eql?(303)
153153

154154
@request.redirect(uri, verb)
155155
end

lib/http/request/writer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def encode_chunk(chunk)
160160
# @return [Boolean]
161161
# @api public
162162
def chunked?
163-
@headers[Headers::TRANSFER_ENCODING] == Headers::CHUNKED
163+
@headers[Headers::TRANSFER_ENCODING].eql?(Headers::CHUNKED)
164164
end
165165

166166
private

lib/http/response/body.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def to_s
110110
# @return [true]
111111
# @api public
112112
def stream!
113-
raise StateError, "body has already been consumed" if @streaming == false
113+
raise StateError, "body has already been consumed" if @streaming.eql?(false)
114114

115115
@streaming = true
116116
end

lib/http/uri.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def initialize(scheme: nil, user: nil, password: nil, host: nil,
148148
# @api public
149149
# @return [TrueClass, FalseClass] are the URIs equivalent (after normalization)?
150150
def ==(other)
151-
other.is_a?(URI) && String(normalize) == String(other.normalize)
151+
other.is_a?(URI) && String(normalize).eql?(String(other.normalize))
152152
end
153153

154154
# Are these URI objects equal without normalization
@@ -162,7 +162,7 @@ def ==(other)
162162
# @api public
163163
# @return [TrueClass, FalseClass] are the URIs equivalent?
164164
def eql?(other)
165-
other.is_a?(URI) && String(self) == String(other)
165+
other.is_a?(URI) && String(self).eql?(String(other))
166166
end
167167

168168
# Hash value based off the normalized form of a URI
@@ -221,7 +221,7 @@ def default_port
221221
# @api public
222222
# @return [String] origin of the URI
223223
def origin
224-
port_suffix = ":#{port}" unless port == default_port
224+
port_suffix = ":#{port}" unless port.eql?(default_port)
225225
"#{String(@scheme).downcase}://#{String(@raw_host).downcase}#{port_suffix}"
226226
end
227227

@@ -282,7 +282,7 @@ def normalize
282282
user: @user,
283283
password: @password,
284284
host: @raw_host&.downcase,
285-
port: (@port unless port == default_port),
285+
port: (@port unless port.eql?(default_port)),
286286
path: @path.empty? && @raw_host ? "/" : @path,
287287
query: @query,
288288
fragment: @fragment
@@ -298,7 +298,7 @@ def normalize
298298
# @return [True] if URI is HTTP
299299
# @return [False] otherwise
300300
def http?
301-
HTTP_SCHEME == @scheme
301+
HTTP_SCHEME.eql?(@scheme)
302302
end
303303

304304
# Checks whether the URI scheme is HTTPS
@@ -310,7 +310,7 @@ def http?
310310
# @return [True] if URI is HTTPS
311311
# @return [False] otherwise
312312
def https?
313-
HTTPS_SCHEME == @scheme
313+
HTTPS_SCHEME.eql?(@scheme)
314314
end
315315

316316
# Duplicates the URI object

0 commit comments

Comments
 (0)