-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1980 from wing328/ruby_add_test
[Ruby] add auto-generated test cases (rspec)
- Loading branch information
Showing
12 changed files
with
1,007 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
modules/swagger-codegen/src/main/resources/ruby/api_test.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require 'spec_helper' | ||
require 'json' | ||
|
||
# Unit tests for {{moduleName}}::{{classname}} | ||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) | ||
# Please update as you see appropriate | ||
{{#operations}}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 | ||
@instance.should be_a({{moduleName}}::{{classname}}) | ||
end | ||
end | ||
|
||
{{#operation}} | ||
# unit tests for {{operationId}} | ||
# {{summary}} | ||
# {{notes}} | ||
{{#allParams}}{{#required}} # @param {{paramName}} {{description}} | ||
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters | ||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}} | ||
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}] | ||
describe '{{operationId}} test' do | ||
it "should work" do | ||
# assertion here | ||
# should be_a() | ||
# should be_nil | ||
# should == | ||
# should_not == | ||
end | ||
end | ||
|
||
{{/operation}} | ||
end | ||
{{/operations}} |
36 changes: 36 additions & 0 deletions
36
modules/swagger-codegen/src/main/resources/ruby/model_test.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 | ||
@instance.should be_a({{moduleName}}::{{classname}}) | ||
end | ||
end | ||
{{#vars}} | ||
describe 'test attribute "{{{name}}}"' do | ||
it 'should work' do | ||
# assertion here | ||
# should be_a() | ||
# should be_nil | ||
# should == | ||
# should_not == | ||
end | ||
end | ||
|
||
{{/vars}} | ||
end | ||
{{/model}}{{/models}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.