fix test cases

This commit is contained in:
William Cheng 2015-04-02 21:37:54 +08:00
parent e73957e790
commit 40d512fe43
5 changed files with 15 additions and 17 deletions

View File

@ -29,7 +29,7 @@ class {{classname}}
}.merge(opts)
#resource path
path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}})
path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s)
{{/pathParams}}{{newline}}
# pull querystring keys from options

View File

@ -225,7 +225,7 @@ class PetApi
}.merge(opts)
#resource path
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
# pull querystring keys from options
@ -271,7 +271,7 @@ class PetApi
}.merge(opts)
#resource path
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
# pull querystring keys from options
@ -316,7 +316,7 @@ class PetApi
}.merge(opts)
#resource path
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
# pull querystring keys from options
@ -361,7 +361,7 @@ class PetApi
}.merge(opts)
#resource path
path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id)
path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
# pull querystring keys from options

View File

@ -122,7 +122,7 @@ class StoreApi
}.merge(opts)
#resource path
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id)
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s)
# pull querystring keys from options
@ -164,7 +164,7 @@ class StoreApi
}.merge(opts)
#resource path
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id)
path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s)
# pull querystring keys from options

View File

@ -282,7 +282,7 @@ class UserApi
}.merge(opts)
#resource path
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username)
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
# pull querystring keys from options
@ -326,7 +326,7 @@ class UserApi
}.merge(opts)
#resource path
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username)
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
# pull querystring keys from options
@ -387,7 +387,7 @@ class UserApi
}.merge(opts)
#resource path
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username)
path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
# pull querystring keys from options

View File

@ -73,20 +73,18 @@ describe Swagger::Request do
describe "path" do
it "accounts for a total absence of format in the path string" do
@request = Swagger::Request.new(:get, "/word.{format}/{word}/entries", @default_params.merge({
@request = Swagger::Request.new(:get, "/word.{format}/cat/entries", @default_params.merge({
:format => "xml",
:params => {
:word => "cat"
}
}))
@request.url.should == "http://petstore.swagger.io/v2/word.xml/cat/entries"
end
it "does string substitution on path params" do
@request = Swagger::Request.new(:get, "/word.{format}/{word}/entries", @default_params.merge({
it "does string substitution (format) on path params" do
@request = Swagger::Request.new(:get, "/word.{format}/cat/entries", @default_params.merge({
:format => "xml",
:params => {
:word => "cat"
}
}))
@request.url.should == "http://petstore.swagger.io/v2/word.xml/cat/entries"
@ -123,7 +121,7 @@ describe Swagger::Request do
end
it "URI encodes the path" do
@request = Swagger::Request.new(:get, "word.{format}/{word}/definitions", @default_params.merge({
@request = Swagger::Request.new(:get, "word.{format}/bill gates/definitions", @default_params.merge({
:params => {
:word => "bill gates"
}
@ -200,4 +198,4 @@ describe Swagger::Request do
end
end
end