Skip to content

Commit 9c5153e

Browse files
committed
fix test cases
1 parent 0a4fc6a commit 9c5153e

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

modules/swagger-codegen/src/main/resources/ruby/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class {{classname}}
3030
}.merge(opts)
3131

3232
#resource path
33-
path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}})
33+
path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s)
3434
{{/pathParams}}{{newline}}
3535

3636
# pull querystring keys from options

samples/client/petstore/ruby/lib/pet_api.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def self.getPetById (pet_id, opts={})
262262
}.merge(opts)
263263

264264
#resource path
265-
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
265+
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
266266

267267

268268
# pull querystring keys from options
@@ -317,7 +317,7 @@ def self.updatePetWithForm (pet_id, name, status, opts={})
317317
}.merge(opts)
318318

319319
#resource path
320-
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
320+
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
321321

322322

323323
# pull querystring keys from options
@@ -371,7 +371,7 @@ def self.deletePet (api_key, pet_id, opts={})
371371
}.merge(opts)
372372

373373
#resource path
374-
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
374+
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
375375

376376

377377
# pull querystring keys from options
@@ -425,7 +425,7 @@ def self.uploadFile (pet_id, additional_metadata, file, opts={})
425425
}.merge(opts)
426426

427427
#resource path
428-
path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
428+
path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
429429

430430

431431
# pull querystring keys from options

samples/client/petstore/ruby/lib/store_api.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def self.getOrderById (order_id, opts={})
141141
}.merge(opts)
142142

143143
#resource path
144-
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id)
144+
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s)
145145

146146

147147
# pull querystring keys from options
@@ -192,7 +192,7 @@ def self.deleteOrder (order_id, opts={})
192192
}.merge(opts)
193193

194194
#resource path
195-
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id)
195+
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s)
196196

197197

198198
# pull querystring keys from options

samples/client/petstore/ruby/lib/user_api.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def self.getUserByName (username, opts={})
328328
}.merge(opts)
329329

330330
#resource path
331-
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username)
331+
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
332332

333333

334334
# pull querystring keys from options
@@ -381,7 +381,7 @@ def self.updateUser (username, body, opts={})
381381
}.merge(opts)
382382

383383
#resource path
384-
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username)
384+
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
385385

386386

387387
# pull querystring keys from options
@@ -451,7 +451,7 @@ def self.deleteUser (username, opts={})
451451
}.merge(opts)
452452

453453
#resource path
454-
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username)
454+
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
455455

456456

457457
# pull querystring keys from options

samples/client/petstore/ruby/spec/request_spec.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,18 @@
7373
describe "path" do
7474

7575
it "accounts for a total absence of format in the path string" do
76-
@request = Swagger::Request.new(:get, "/word.{format}/{word}/entries", @default_params.merge({
76+
@request = Swagger::Request.new(:get, "/word.{format}/cat/entries", @default_params.merge({
7777
:format => "xml",
7878
:params => {
79-
:word => "cat"
8079
}
8180
}))
8281
@request.url.should == "http://petstore.swagger.io/v2/word.xml/cat/entries"
8382
end
8483

85-
it "does string substitution on path params" do
86-
@request = Swagger::Request.new(:get, "/word.{format}/{word}/entries", @default_params.merge({
84+
it "does string substitution (format) on path params" do
85+
@request = Swagger::Request.new(:get, "/word.{format}/cat/entries", @default_params.merge({
8786
:format => "xml",
8887
:params => {
89-
:word => "cat"
9088
}
9189
}))
9290
@request.url.should == "http://petstore.swagger.io/v2/word.xml/cat/entries"
@@ -123,7 +121,7 @@
123121
end
124122

125123
it "URI encodes the path" do
126-
@request = Swagger::Request.new(:get, "word.{format}/{word}/definitions", @default_params.merge({
124+
@request = Swagger::Request.new(:get, "word.{format}/bill gates/definitions", @default_params.merge({
127125
:params => {
128126
:word => "bill gates"
129127
}
@@ -200,4 +198,4 @@
200198

201199
end
202200

203-
end
201+
end

0 commit comments

Comments
 (0)