forked from loafle/openapi-generator-original
46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
=begin
|
|
{{> api_info}}
|
|
=end
|
|
|
|
require 'spec_helper'
|
|
require 'json'
|
|
require 'date'
|
|
|
|
# Unit tests for {{moduleName}}::{{classname}}
|
|
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
|
# Please update as you see appropriate
|
|
{{#models}}{{#model}}describe '{{classname}}' do
|
|
before do
|
|
# run before each test
|
|
@instance = {{moduleName}}::{{classname}}.new
|
|
end
|
|
|
|
after do
|
|
# run after each test
|
|
end
|
|
|
|
describe 'test an instance of {{classname}}' do
|
|
it 'should create an instact of {{classname}}' do
|
|
expect(@instance).to be_instance_of({{moduleName}}::{{classname}})
|
|
end
|
|
end
|
|
{{#vars}}
|
|
describe 'test attribute "{{{name}}}"' do
|
|
it 'should work' do
|
|
{{#isEnum}}
|
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
#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
|
|
|
|
{{/vars}}
|
|
end
|
|
{{/model}}{{/models}}
|