diff --git a/samples/client/petstore/ruby/spec/pet_spec.rb b/samples/client/petstore/ruby/spec/pet_spec.rb index 68858c7b6cd..e05dd726f13 100644 --- a/samples/client/petstore/ruby/spec/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/pet_spec.rb @@ -13,9 +13,14 @@ describe "Pet" do tag2 = SwaggerClient::Tag.new({'id' => 2, 'name'=> 'tag2'}) category1 = SwaggerClient::Category.new({:id => 1, :name => 'category unknown'}) # initalize using both string and symbol key - pet_hash = {:'id' => 10002, :'name' => "RUBY UNIT TESTING", :'status' => "pending", - :'photo_urls' => ["url1", "url2"], :'category' => category1, - :'tags' => [tag1, tag2]} + pet_hash = { + :id => 10002, + :name => "RUBY UNIT TESTING", + :status => "pending", + :photo_urls => ["url1", "url2"], + :category => category1, + :tags => [tag1, tag2] + } pet = SwaggerClient::Pet.new(pet_hash) # test new pet.name.should == "RUBY UNIT TESTING" @@ -48,6 +53,10 @@ describe "Pet" do it "should find pets by status" do pets = SwaggerClient::PetApi.find_pets_by_status(:status => 'available') pets.length.should >= 3 + pets.each do |pet| + pet.should be_a(SwaggerClient::Pet) + pet.status.should == 'available' + end end it "should not find a pet with invalid status" do @@ -57,11 +66,11 @@ describe "Pet" do it "should find a pet by status" do pets = SwaggerClient::PetApi.find_pets_by_status(:status => "available,sold") - pets.map {|pet| - if(pet.status != 'available' && pet.status != 'sold') + pets.each do |pet| + if pet.status != 'available' && pet.status != 'sold' raise "pet status wasn't right" end - } + end end it "should update a pet" do diff --git a/samples/client/petstore/ruby/spec/store_spec.rb b/samples/client/petstore/ruby/spec/store_spec.rb index 1b37400bc5c..3ad09f1ad61 100644 --- a/samples/client/petstore/ruby/spec/store_spec.rb +++ b/samples/client/petstore/ruby/spec/store_spec.rb @@ -10,4 +10,14 @@ describe "Store" do item = SwaggerClient::StoreApi.get_order_by_id(10002) item.id.should == 10002 end + + it "should featch the inventory" do + result = SwaggerClient::StoreApi.get_inventory + result.should be_a(Hash) + result.should_not be_empty + result.each do |k, v| + k.should be_a(Symbol) + v.should be_a(Integer) + end + end end