fix rspec due to change of optional parameter in ruby method

This commit is contained in:
wing328 2015-04-17 01:03:15 +08:00
parent c30ed059fe
commit c87579e1f7
2 changed files with 8 additions and 8 deletions

View File

@ -15,17 +15,17 @@ describe "Pet" do
end end
it "should find pets by status" do it "should find pets by status" do
pets = PetApi.find_pets_by_status('available') pets = PetApi.find_pets_by_status(:status => 'available')
pets.length.should >= 3 pets.length.should >= 3
end end
it "should not find a pet with invalid status" do it "should not find a pet with invalid status" do
pets = PetApi.find_pets_by_status('invalid-status') pets = PetApi.find_pets_by_status(:status => 'invalid-status')
pets.length.should == 0 pets.length.should == 0
end end
it "should find a pet by status" do it "should find a pet by status" do
pets = PetApi.find_pets_by_status("available,sold") pets = PetApi.find_pets_by_status(:status => "available,sold")
pets.map {|pet| pets.map {|pet|
if(pet.status != 'available' && pet.status != 'sold') if(pet.status != 'available' && pet.status != 'sold')
raise "pet status wasn't right" raise "pet status wasn't right"
@ -35,7 +35,7 @@ describe "Pet" do
it "should update a pet" do it "should update a pet" do
pet = Pet.new({'id' => 10002, 'status' => 'sold'}) pet = Pet.new({'id' => 10002, 'status' => 'sold'})
PetApi.add_pet(pet) PetApi.add_pet(:body => pet)
fetched = PetApi.get_pet_by_id(10002) fetched = PetApi.get_pet_by_id(10002)
fetched.id.should == 10002 fetched.id.should == 10002
@ -44,7 +44,7 @@ describe "Pet" do
it "should create a pet" do it "should create a pet" do
pet = Pet.new('id' => 10002, 'name' => "RUBY UNIT TESTING") pet = Pet.new('id' => 10002, 'name' => "RUBY UNIT TESTING")
PetApi.add_pet(pet) PetApi.add_pet(:body => pet)
pet = PetApi.get_pet_by_id(10002) pet = PetApi.get_pet_by_id(10002)
pet.id.should == 10002 pet.id.should == 10002

View File

@ -47,10 +47,10 @@ end
# 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 def prepare_pet
# remove the pet # remove the pet
PetApi.delete_pet('special-key', 10002) PetApi.delete_pet(10002)
# recreate the pet # recreate the pet
pet = Pet.new('id' => 10002, 'name' => "RUBY UNIT TESTING") pet = Pet.new('id' => 10002, 'name' => "RUBY UNIT TESTING")
PetApi.add_pet(pet) PetApi.add_pet(:body => pet)
end end
# always delete and then re-create the store order # always delete and then re-create the store order
@ -61,7 +61,7 @@ def prepare_store
"shipDate" => "2015-04-06T23:42:01.678Z", "shipDate" => "2015-04-06T23:42:01.678Z",
"status" => "placed", "status" => "placed",
"complete" => false) "complete" => false)
StoreApi.place_order(order) StoreApi.place_order(:body => order)
end end
configure_swagger configure_swagger