diff --git a/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache b/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache index 305a10d6467..9425585780f 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/model_test.mustache @@ -27,7 +27,15 @@ require 'date' {{#vars}} describe 'test attribute "{{{name}}}"' do it 'should work' do + {{#isEnum}} + validator = Petstore::EnumTest::EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]) + validator.allowable_values.each do |value| + expect { @instance.{{name}} = value }.not_to raise_error + end + {{/isEnum}} + {{^isEnum}} # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + {{/isEnum}} end end diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 8767f816482..03e5ef14f4f 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-23T20:51:09.022+08:00 +- Build date: 2016-05-23T21:28:35.293+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb b/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb index 016b86fd8af..1535c7cb4ec 100644 --- a/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb +++ b/samples/client/petstore/ruby/spec/models/animal_farm_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/animal_spec.rb b/samples/client/petstore/ruby/spec/models/animal_spec.rb index 3f98b0f7b84..5c4f8dc0e69 100644 --- a/samples/client/petstore/ruby/spec/models/animal_spec.rb +++ b/samples/client/petstore/ruby/spec/models/animal_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -42,5 +42,11 @@ describe 'Animal' do end end + describe 'test attribute "color"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + end diff --git a/samples/client/petstore/ruby/spec/models/api_response_spec.rb b/samples/client/petstore/ruby/spec/models/api_response_spec.rb index 67b0cbe1a03..18ab87bf551 100644 --- a/samples/client/petstore/ruby/spec/models/api_response_spec.rb +++ b/samples/client/petstore/ruby/spec/models/api_response_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/cat_spec.rb b/samples/client/petstore/ruby/spec/models/cat_spec.rb index 97ae668ea3b..86d600213b3 100644 --- a/samples/client/petstore/ruby/spec/models/cat_spec.rb +++ b/samples/client/petstore/ruby/spec/models/cat_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -42,6 +42,12 @@ describe 'Cat' do end end + describe 'test attribute "color"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + describe 'test attribute "declawed"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers diff --git a/samples/client/petstore/ruby/spec/models/category_spec.rb b/samples/client/petstore/ruby/spec/models/category_spec.rb index 1481358afdc..021de250efc 100644 --- a/samples/client/petstore/ruby/spec/models/category_spec.rb +++ b/samples/client/petstore/ruby/spec/models/category_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/dog_spec.rb b/samples/client/petstore/ruby/spec/models/dog_spec.rb index e3eb4be12fc..10a5b831f25 100644 --- a/samples/client/petstore/ruby/spec/models/dog_spec.rb +++ b/samples/client/petstore/ruby/spec/models/dog_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -42,6 +42,12 @@ describe 'Dog' do end end + describe 'test attribute "color"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + describe 'test attribute "breed"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers diff --git a/samples/client/petstore/ruby/spec/models/enum_class_spec.rb b/samples/client/petstore/ruby/spec/models/enum_class_spec.rb index b8610d74a1b..02fe0a113fe 100644 --- a/samples/client/petstore/ruby/spec/models/enum_class_spec.rb +++ b/samples/client/petstore/ruby/spec/models/enum_class_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/enum_test_spec.rb b/samples/client/petstore/ruby/spec/models/enum_test_spec.rb index 91941d8a50d..f85c15564f1 100644 --- a/samples/client/petstore/ruby/spec/models/enum_test_spec.rb +++ b/samples/client/petstore/ruby/spec/models/enum_test_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -38,19 +38,28 @@ describe 'EnumTest' do end describe 'test attribute "enum_string"' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UPPER", "lower"]) + validator.allowable_values.each do |value| + expect { @instance.enum_string = value }.not_to raise_error + end end end describe 'test attribute "enum_integer"' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + validator = Petstore::EnumTest::EnumAttributeValidator.new('Integer', ["1", "-1"]) + validator.allowable_values.each do |value| + expect { @instance.enum_integer = value }.not_to raise_error + end end end describe 'test attribute "enum_number"' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + validator = Petstore::EnumTest::EnumAttributeValidator.new('Float', ["1.1", "-1.2"]) + validator.allowable_values.each do |value| + expect { @instance.enum_number = value }.not_to raise_error + end end end diff --git a/samples/client/petstore/ruby/spec/models/format_test_spec.rb b/samples/client/petstore/ruby/spec/models/format_test_spec.rb index e7a81fe537c..fd6cf6c0381 100644 --- a/samples/client/petstore/ruby/spec/models/format_test_spec.rb +++ b/samples/client/petstore/ruby/spec/models/format_test_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb index 8b8879105d0..b986604e1ef 100644 --- a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/model_return_spec.rb b/samples/client/petstore/ruby/spec/models/model_return_spec.rb index 5a80c97542b..d21f4f1ed3e 100644 --- a/samples/client/petstore/ruby/spec/models/model_return_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_return_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/name_spec.rb b/samples/client/petstore/ruby/spec/models/name_spec.rb index 03a9c69ece1..5ad2a851827 100644 --- a/samples/client/petstore/ruby/spec/models/name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/name_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -54,5 +54,11 @@ describe 'Name' do end end + describe 'test attribute "_123_number"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + end diff --git a/samples/client/petstore/ruby/spec/models/order_spec.rb b/samples/client/petstore/ruby/spec/models/order_spec.rb index 73bd5c082fd..008d226ce6e 100644 --- a/samples/client/petstore/ruby/spec/models/order_spec.rb +++ b/samples/client/petstore/ruby/spec/models/order_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -62,7 +62,10 @@ describe 'Order' do describe 'test attribute "status"' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["placed", "approved", "delivered"]) + validator.allowable_values.each do |value| + expect { @instance.status = value }.not_to raise_error + end end end diff --git a/samples/client/petstore/ruby/spec/models/pet_spec.rb b/samples/client/petstore/ruby/spec/models/pet_spec.rb index 9911ced1366..72780cf80c9 100644 --- a/samples/client/petstore/ruby/spec/models/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/models/pet_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -68,7 +68,10 @@ describe 'Pet' do describe 'test attribute "status"' do it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["available", "pending", "sold"]) + validator.allowable_values.each do |value| + expect { @instance.status = value }.not_to raise_error + end end end diff --git a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb index cd93568e8f9..5b10f4c8f9f 100644 --- a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/tag_spec.rb b/samples/client/petstore/ruby/spec/models/tag_spec.rb index 68b77e026b1..c6a5a954b7e 100644 --- a/samples/client/petstore/ruby/spec/models/tag_spec.rb +++ b/samples/client/petstore/ruby/spec/models/tag_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/user_spec.rb b/samples/client/petstore/ruby/spec/models/user_spec.rb index fc510605b5c..ae780d5d656 100644 --- a/samples/client/petstore/ruby/spec/models/user_spec.rb +++ b/samples/client/petstore/ruby/spec/models/user_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io