Skip to content

Commit

Permalink
review: Lint (a bit more than this PR is about)
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Aug 26, 2024
1 parent 151ee0b commit fa733a2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .rubocop/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ RSpec/ExampleLength:
- hash
- heredoc
- method_call

RSpec/MultipleExpectations:
Max: 5
24 changes: 0 additions & 24 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,30 +267,6 @@ RSpec/InstanceVariable:
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 74
# Configuration parameters: Max.
RSpec/MultipleExpectations:
Exclude:
- 'spec/lib/http/client_spec.rb'
- 'spec/lib/http/connection_spec.rb'
- 'spec/lib/http/features/auto_deflate_spec.rb'
- 'spec/lib/http/headers_spec.rb'
- 'spec/lib/http/options/body_spec.rb'
- 'spec/lib/http/options/features_spec.rb'
- 'spec/lib/http/options/form_spec.rb'
- 'spec/lib/http/options/headers_spec.rb'
- 'spec/lib/http/options/json_spec.rb'
- 'spec/lib/http/options/merge_spec.rb'
- 'spec/lib/http/options/proxy_spec.rb'
- 'spec/lib/http/redirector_spec.rb'
- 'spec/lib/http/response/body_spec.rb'
- 'spec/lib/http/response/parser_spec.rb'
- 'spec/lib/http/retriable/delay_calculator_spec.rb'
- 'spec/lib/http/retriable/performer_spec.rb'
- 'spec/lib/http/uri_spec.rb'
- 'spec/lib/http_spec.rb'
- 'spec/support/http_handling_shared.rb'

# Offense count: 9
# Configuration parameters: AllowSubject, Max.
RSpec/MultipleMemoizedHelpers:
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/http/headers/normalizer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

expect(normalized_headers)
.to satisfy { |arr| arr.uniq.size == 1 }
.and satisfy { |arr| arr.map(&:object_id).uniq.size == normalized_headers.size }
.and satisfy { |arr| arr.none?(&:frozen?) }
.and(satisfy { |arr| arr.map(&:object_id).uniq.size == normalized_headers.size })
.and(satisfy { |arr| arr.none?(&:frozen?) })
end

it "allocates minimal memory for normalization of the same header" do
Expand Down
11 changes: 6 additions & 5 deletions spec/lib/http/redirector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ def redirect_response(status, location, set_cookie = {})
expect(req_cookie).to eq request_cookies.shift
hops.shift
end

expect(res.to_s).to eq "bar"
cookies = res.cookies.cookies.to_h { |c| [c.name, c.value] }
expect(cookies["foo"]).to eq "42"
expect(cookies["bar"]).to eq "53"
expect(cookies["baz"]).to eq "65"
expect(cookies["deleted"]).to eq nil
expect(res.cookies.cookies.to_h { |c| [c.name, c.value] }).to eq({
"foo" => "42",
"bar" => "53",
"baz" => "65"
})
end

it "returns original cookies in response" do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/http/retriable/performer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def response(**options)
end

describe "should_retry option" do
it "decides if the request should be retried" do
it "decides if the request should be retried" do # rubocop:disable RSpec/MultipleExpectations
retry_proc = proc do |req, err, res, attempt|
expect(req).to eq request
if res
Expand Down

0 comments on commit fa733a2

Please sign in to comment.