Skip to content

Commit

Permalink
cop-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
0exp committed Jun 18, 2024
1 parent 91b82aa commit 059ddc7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ezclient/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def error?

def inspect
{
request: {
req: {
raw: http_request.inspect,
headers: http_request.headers,
hdrs: http_request.headers,
},
response: {
resp: {
raw: http_response.inspect,
headers: headers,
hdrs: headers,
body: body,
},
}.to_s
Expand Down
16 changes: 16 additions & 0 deletions spec/ezclient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,22 @@ def self.sign!(*); end
let(:response) { request.perform }
let(:webmock_response) { { status: 201 } }

context "object inspectation" do
specify 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)
end
end

context "201 response code" do
specify do
expect(response.code).to eq(201)
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "simplecov"
require "simplecov-lcov"
require "pry"

SimpleCov::Formatter::LcovFormatter.config do |config|
config.report_with_single_file = true
Expand Down

0 comments on commit 059ddc7

Please sign in to comment.