mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 15:22:56 +00:00
Basic functionality via minitest
This commit is contained in:
25
lib/swagger_rails/testing/test_visitor.rb
Normal file
25
lib/swagger_rails/testing/test_visitor.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
require 'swagger_rails/testing/example_builder'
|
||||
|
||||
module SwaggerRails
|
||||
|
||||
class TestVisitor
|
||||
|
||||
def initialize(swagger)
|
||||
@swagger = swagger
|
||||
end
|
||||
|
||||
def run_test(path_template, http_method, test, &block)
|
||||
example = ExampleBuilder.new(path_template, http_method, @swagger)
|
||||
example.instance_exec(&block) if block_given?
|
||||
|
||||
test.send(http_method,
|
||||
example.path,
|
||||
example.params,
|
||||
example.headers
|
||||
)
|
||||
|
||||
test.assert_response(example.expected_status)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user