mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-22 08:40:50 +00:00
Merge pull request #1878 from xhh/ruby-test-fix
Ruby: fix testing issue of deleting nonexistent pet
This commit is contained in:
commit
c110270cf4
@ -40,8 +40,13 @@ API_CLIENT = Petstore::ApiClient.new(Petstore::Configuration.new)
|
|||||||
|
|
||||||
# always delete and then re-create the pet object with 10002
|
# always delete and then re-create the pet object with 10002
|
||||||
def prepare_pet(pet_api)
|
def prepare_pet(pet_api)
|
||||||
|
begin
|
||||||
# remove the pet
|
# remove the pet
|
||||||
pet_api.delete_pet(10002)
|
pet_api.delete_pet(10002)
|
||||||
|
rescue Petstore::ApiError => e
|
||||||
|
# ignore ApiError 404 (Not Found)
|
||||||
|
raise e if e.code != 404
|
||||||
|
end
|
||||||
# recreate the pet
|
# recreate the pet
|
||||||
category = Petstore::Category.new('id' => 20002, 'name' => 'category test')
|
category = Petstore::Category.new('id' => 20002, 'name' => 'category test')
|
||||||
tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')
|
tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user