mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-26 07:42:58 +00:00
assert response body based on spec examples
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require 'swagger_rails/testing/test_data_builder'
|
||||
require 'swagger_rails/testing/test_case_builder'
|
||||
|
||||
module SwaggerRails
|
||||
|
||||
@@ -9,7 +9,7 @@ module SwaggerRails
|
||||
end
|
||||
|
||||
def run_test(path_template, http_method, test, &block)
|
||||
builder = TestDataBuilder.new(path_template, http_method, @swagger)
|
||||
builder = TestCaseBuilder.new(path_template, http_method, @swagger)
|
||||
builder.instance_exec(&block) if block_given?
|
||||
test_data = builder.test_data
|
||||
|
||||
@@ -19,7 +19,8 @@ module SwaggerRails
|
||||
test_data[:headers]
|
||||
)
|
||||
|
||||
test.assert_response(test_data[:expected_status])
|
||||
test.assert_response(test_data[:expected_response][:status])
|
||||
test.assert_equal(test_data[:expected_response][:body], JSON.parse(test.response.body))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user