forked from loafle/openapi-generator-original
Better format for Ruby tests (#1166)
* better format for ruby test * update ruby petstore
This commit is contained in:
parent
3e3b03f93b
commit
06d31cfedb
@ -85,7 +85,7 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf
|
||||
super.processOpts();
|
||||
|
||||
if (StringUtils.isEmpty(System.getenv("RUBY_POST_PROCESS_FILE"))) {
|
||||
LOGGER.info("Hint: Environment variable 'RUBY_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export RUBY_POST_PROCESS_FILE=/usr/local/bin/rubocop -a' (Linux/Mac)");
|
||||
LOGGER.info("Hint: Environment variable 'RUBY_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export RUBY_POST_PROCESS_FILE=\"/usr/local/bin/rubocop -a\"' (Linux/Mac)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,13 +65,13 @@ describe Petstore::ApiClient do
|
||||
header_params = {}
|
||||
query_params = {}
|
||||
api_client.update_params_for_auth! header_params, query_params, auth_names
|
||||
expect(header_params).to eq({'api_key' => 'PREFIX special-key'})
|
||||
expect(header_params).to eq('api_key' => 'PREFIX special-key')
|
||||
expect(query_params).to eq({})
|
||||
|
||||
header_params = {}
|
||||
query_params = {}
|
||||
api_client2.update_params_for_auth! header_params, query_params, auth_names
|
||||
expect(header_params).to eq({'api_key' => 'PREFIX2 special-key2'})
|
||||
expect(header_params).to eq('api_key' => 'PREFIX2 special-key2')
|
||||
expect(query_params).to eq({})
|
||||
end
|
||||
|
||||
@ -87,7 +87,7 @@ describe Petstore::ApiClient do
|
||||
query_params = {}
|
||||
auth_names = ['api_key', 'unknown']
|
||||
api_client.update_params_for_auth! header_params, query_params, auth_names
|
||||
expect(header_params).to eq({'api_key' => 'special-key'})
|
||||
expect(header_params).to eq('api_key' => 'special-key')
|
||||
expect(query_params).to eq({})
|
||||
end
|
||||
end
|
||||
@ -136,7 +136,7 @@ describe Petstore::ApiClient do
|
||||
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
||||
data = api_client.deserialize(response, 'Hash<String, String>')
|
||||
expect(data).to be_a(Hash)
|
||||
expect(data).to eq({:message => 'Hello'})
|
||||
expect(data).to eq(:message => 'Hello')
|
||||
end
|
||||
|
||||
it "handles Hash<String, Pet>" do
|
||||
|
@ -32,7 +32,7 @@ end
|
||||
|
||||
describe 'BaseObject' do
|
||||
describe 'boolean values' do
|
||||
let(:obj) { Petstore::Cat.new({declawed: false}) }
|
||||
let(:obj) { Petstore::Cat.new(declawed: false) }
|
||||
|
||||
it 'should have values set' do
|
||||
expect(obj.declawed).not_to be_nil
|
||||
@ -68,7 +68,7 @@ describe 'BaseObject' do
|
||||
expect(pet.name).to eq('Kitty')
|
||||
|
||||
expect(obj.int_map).to be_instance_of(Hash)
|
||||
expect(obj.int_map).to eq({'int' => 123})
|
||||
expect(obj.int_map).to eq('int' => 123)
|
||||
|
||||
expect(obj.pet_map).to be_instance_of(Hash)
|
||||
pet = obj.pet_map['pet']
|
||||
|
@ -19,9 +19,9 @@ describe "Pet" do
|
||||
|
||||
describe "pet methods" do
|
||||
it "should construct a new pet object" do
|
||||
tag1 = Petstore::Tag.new({'id' => 1, 'name'=> 'tag1'})
|
||||
tag2 = Petstore::Tag.new({'id' => 2, 'name'=> 'tag2'})
|
||||
category1 = Petstore::Category.new({:id => 1, :name => 'category unknown'})
|
||||
tag1 = Petstore::Tag.new('id' => 1, 'name' => 'tag1')
|
||||
tag2 = Petstore::Tag.new('id' => 2, 'name' => 'tag2')
|
||||
category1 = Petstore::Category.new(:id => 1, :name => 'category unknown')
|
||||
# initalize using both string and symbol key
|
||||
pet_hash = {
|
||||
:id => @pet_id,
|
||||
|
@ -114,7 +114,7 @@ def prepare_pet(pet_api)
|
||||
pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url',
|
||||
'category' => category, 'tags' => [tag], 'status' => 'pending')
|
||||
pet_api.add_pet(pet)
|
||||
return pet_id
|
||||
pet_id
|
||||
end
|
||||
|
||||
# create a random order, return its id
|
||||
@ -127,7 +127,7 @@ def prepare_store(store_api)
|
||||
"status" => "placed",
|
||||
"complete" => false)
|
||||
store_api.place_order(order)
|
||||
return order_id
|
||||
order_id
|
||||
end
|
||||
|
||||
# A random string to tack onto stuff to ensure we're not seeing
|
||||
|
Loading…
x
Reference in New Issue
Block a user