fix rubocop warns in Ruby client's custom spec (#5488)

This commit is contained in:
Akira Tanimura
2020-03-01 11:54:17 +09:00
committed by GitHub
parent 165ad45797
commit d094cca99a
2 changed files with 2 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ describe "Pet" do
tag1 = Petstore::Tag.new('id' => 1, 'name' => 'tag1')
tag2 = Petstore::Tag.new('id' => 2, 'name' => 'tag2')
category1 = Petstore::Category.new(:id => 1, :name => 'category unknown')
# initalize using both string and symbol key
# initialize using both string and symbol key
pet_hash = {
:id => @pet_id,
:name => "RUBY UNIT TESTING",
@@ -79,7 +79,7 @@ describe "Pet" do
rescue Petstore::ApiError => e
expect(e.code).to eq(404)
# skip the check as the response contains a timestamp that changes on every reponse
#expect(e.message).to eq("Error message: the server returns an error\nHTTP status code: 404\nResponse headers: {\"Date\"=>\"Tue, 26 Feb 2019 04:35:40 GMT\", \"Access-Control-Allow-Origin\"=>\"*\", \"Access-Control-Allow-Methods\"=>\"GET, POST, DELETE, PUT\", \"Access-Control-Allow-Headers\"=>\"Content-Type, api_key, Authorization\", \"Content-Type\"=>\"application/json\", \"Connection\"=>\"close\", \"Server\"=>\"Jetty(9.2.9.v20150224)\"}\nResponse body: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}")
# expect(e.message).to eq("Error message: the server returns an error\nHTTP status code: 404\nResponse headers: {\"Date\"=>\"Tue, 26 Feb 2019 04:35:40 GMT\", \"Access-Control-Allow-Origin\"=>\"*\", \"Access-Control-Allow-Methods\"=>\"GET, POST, DELETE, PUT\", \"Access-Control-Allow-Headers\"=>\"Content-Type, api_key, Authorization\", \"Content-Type\"=>\"application/json\", \"Connection\"=>\"close\", \"Server\"=>\"Jetty(9.2.9.v20150224)\"}\nResponse body: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}")
expect(e.response_body).to eq('{"code":1,"type":"error","message":"Pet not found"}')
expect(e.response_headers).to include('Content-Type')
expect(e.response_headers['Content-Type']).to eq('application/json')

View File

@@ -48,5 +48,3 @@ def deserialize_json(s, type)
response = double('response', headers: headers, body: s)
API_CLIENT.deserialize(response, type)
end