diff --git a/.rubocop.yml b/.rubocop.yml index 6a5c318..90ad95e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,8 +17,8 @@ AllCops: Exclude: - vendor/**/* -RSpec/Rails/HaveHttpStatus: +RSpec/SpecFilePathFormat: Enabled: false -RSpec/SpecFilePathFormat: +RSpec/ExpectInLet: Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index d3e8522..cae0381 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.1.3.4) + activesupport (7.1.4) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -23,7 +23,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) coderay (1.1.3) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) coveralls (0.7.2) multi_json (~> 1.3) @@ -42,17 +42,17 @@ GEM ffi-compiler (1.3.2) ffi (>= 1.15.5) rake - hashdiff (1.1.0) + hashdiff (1.1.1) http (5.2.0) addressable (~> 2.8) base64 (~> 0.1) http-cookie (~> 1.0) http-form_data (~> 2.2) llhttp-ffi (~> 0.5.0) - http-cookie (1.0.6) + http-cookie (1.0.7) domain_name (~> 0.5) http-form_data (2.3.0) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) json (2.7.2) language_server-protocol (3.17.0.3) @@ -62,12 +62,12 @@ GEM method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0702) - minitest (5.24.1) + mime-types-data (3.2024.0903) + minitest (5.25.1) multi_json (1.15.0) mutex_m (0.2.0) - parallel (1.25.1) - parser (3.3.4.0) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc pry (0.14.2) @@ -81,61 +81,53 @@ GEM regexp_parser (2.9.2) rest-client (1.6.7) mime-types (>= 1.16) - rexml (3.3.2) - strscan + rexml (3.3.7) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.1) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) - rubocop (1.63.5) + rubocop (1.66.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-config-umbrellio (1.63.0.93) - rubocop (~> 1.63.0) - rubocop-performance (~> 1.21.0) - rubocop-rails (~> 2.24.0) + rubocop-config-umbrellio (1.66.0.99) + rubocop (~> 1.66.0) + rubocop-factory_bot (~> 2.26.0) + rubocop-performance (~> 1.22.0) + rubocop-rails (~> 2.26.0) rubocop-rake (~> 0.6.0) - rubocop-rspec (~> 2.29.0) + rubocop-rspec (~> 3.0.0) rubocop-sequel (~> 0.3.3) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) - rubocop-performance (1.21.1) + rubocop-performance (1.22.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.24.1) + rubocop-rails (2.26.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) + rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.29.2) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - rubocop-rspec_rails (~> 2.28) - rubocop-rspec_rails (2.29.1) + rubocop-rspec (3.0.5) rubocop (~> 1.61) rubocop-sequel (0.3.4) rubocop (~> 1.0) @@ -144,17 +136,16 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) - strscan (3.1.0) term-ansicolor (1.2.2) tins (~> 0.8) thor (0.18.1) tins (0.13.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -177,4 +168,4 @@ DEPENDENCIES webmock BUNDLED WITH - 2.5.16 + 2.5.18 diff --git a/ezclient.gemspec b/ezclient.gemspec index 5fefa31..f767b0f 100644 --- a/ezclient.gemspec +++ b/ezclient.gemspec @@ -19,5 +19,5 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) } spec.require_paths = ["lib"] - spec.add_runtime_dependency "http", ">= 4" + spec.add_dependency "http", ">= 4" end diff --git a/lib/ezclient/response.rb b/lib/ezclient/response.rb index 6f0f641..b263819 100644 --- a/lib/ezclient/response.rb +++ b/lib/ezclient/response.rb @@ -42,20 +42,6 @@ def error? client_error? || server_error? end - def inspect - { - req: { - raw: http_request.inspect, - hdrs: http_request.headers, - }, - resp: { - raw: http_response.inspect, - hdrs: headers, - body: body, - }, - }.to_s - end - def to_s inspect end diff --git a/lib/ezclient/version.rb b/lib/ezclient/version.rb index 6d4e8c6..6104649 100644 --- a/lib/ezclient/version.rb +++ b/lib/ezclient/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module EzClient - VERSION = "1.7.0" + VERSION = "1.7.1" end diff --git a/spec/ezclient_spec.rb b/spec/ezclient_spec.rb index f3cc76a..8abe2ad 100644 --- a/spec/ezclient_spec.rb +++ b/spec/ezclient_spec.rb @@ -396,45 +396,18 @@ def self.sign!(*); end context "object inspectation" do specify "#inspect" do - expect(response.inspect).to match({ - req: { - raw: response.http_request.inspect, - hdrs: response.http_request.headers, - }, - resp: { - raw: response.http_response.inspect, - hdrs: response.http_response.headers, - body: response.body, - }, - }.to_s) + expect(response.inspect.gsub(/0x\w+/, "0x0000")) + .to eq(<<~TXT.tr("\n", " ").gsub(/\s+/, " ").strip) + #, + @http_request=#, + @body=""> + TXT end specify "#to_s" do aggregate_failures " representation" do expect(response.inspect).to eq(response.to_s) - - # NOTE: - # - for better visual representability; - # - example.com is fetched from `request` object: - # - see request (@http_request.host) - # - see request.verb - # - see request.url - # rubocop:disable Layout/LineEndStringConcatenationIndentation - # rubocop:disable Style/TrailingCommaInArguments - expect(response.inspect).to eq( - "{:req=>{" \ - ":raw=>\"#\", " \ - ":hdrs=>#\"ezclient/#{EzClient::VERSION}\", " \ - "\"Connection\"=>\"close\", " \ - "\"Host\"=>\"example.com\"}>}, " \ - ":resp=>{" \ - ":raw=>\"#\", " \ - ":hdrs=>#, " \ - ":body=>\"\"}}" - ) - # rubocop:enable Layout/LineEndStringConcatenationIndentation - # rubocop:enable Style/TrailingCommaInArguments end end end