4
4
before do
5
5
Swagger . configure do |config |
6
6
config . api_key = 'special-key'
7
- config . host = 'petstore.swagger.wordnik.com '
8
- config . base_path = '/api '
7
+ config . host = 'petstore.swagger.io '
8
+ config . base_path = '/v2 '
9
9
end
10
10
end
11
11
12
12
describe "pet methods" do
13
13
it "should fetch a pet object" do
14
- pet = Pet_api . get_pet_by_id ( 1 )
15
- pet . id . should == 1
16
- pet . name . should == "Cat 1 "
14
+ pet = PetApi . getPetById ( 5 )
15
+ pet . id . should == 5
16
+ pet . name . should == "Dog 2 "
17
17
end
18
18
19
19
it "should find pets by status" do
20
- pets = Pet_api . find_pets_by_status ( 'available' )
20
+ pets = PetApi . findPetsByStatus ( 'available' )
21
21
pets . length . should >= 3
22
22
end
23
23
24
24
it "should not find a pet with invalid status" do
25
- pets = Pet_api . find_pets_by_status ( 'dead' )
25
+ pets = PetApi . findPetsByStatus ( 'dead' )
26
26
pets . length . should == 0
27
27
end
28
28
29
29
it "should find a pet by status" do
30
- pets = Pet_api . find_pets_by_status ( "available,sold" )
30
+ pets = PetApi . findPetsByStatus ( "available,sold" )
31
31
pets . map { |pet |
32
32
if ( pet . status != 'available' && pet . status != 'sold' )
33
33
raise "pet status wasn't right"
36
36
end
37
37
38
38
it "should update a pet" do
39
- pet = Pet . new ( { :id => 99 , : name => 'programmer' , : status => 'coding' } )
40
- Pet_api . add_pet ( pet )
39
+ pet = Pet . new ( { 'id' => 99 , ' name' => 'programmer' , ' status' => 'coding' } )
40
+ PetApi . addPet ( pet )
41
41
42
- fetched = Pet_api . get_pet_by_id ( 99 )
42
+ fetched = PetApi . getPetById ( 99 )
43
43
fetched . id . should == 99
44
44
end
45
45
46
46
it "should create a pet" do
47
- pet = Pet . new ( { :id => 100 , : name => "Gorilla" } )
48
- raise pet . inspect
49
- Pet_api . add_pet ( pet )
47
+ pet = Pet . new ( 'id' => 100 , ' name' => "Gorilla" )
48
+ # raise pet.inspect
49
+ PetApi . addPet ( pet )
50
50
51
- pet = Pet_api . get_pet_by_id ( 100 )
51
+ pet = PetApi . getPetById ( 100 )
52
52
pet . id . should == 100
53
53
end
54
54
end
58
58
before do
59
59
Swagger . configure do |config |
60
60
config . api_key = 'special-key'
61
- config . host = 'petstore.swagger.wordnik.com '
62
- config . base_path = '/api '
61
+ config . host = 'petstore.swagger.io '
62
+ config . base_path = '/v2 '
63
63
end
64
64
end
65
65
66
66
it "should fetch an order" do
67
- item = Store_api . get_order_by_id ( 1 )
68
- item . id . should == 1
67
+ item = StoreApi . getOrderById ( 2 )
68
+ item . id . should == 2
69
69
end
70
- end
70
+ end
0 commit comments