mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-24 14:56:41 +00:00
Fix deprecation warning for ActionDispatch::IntegrationTest HTTP request methods will accept only the following keyword arguments in future Rails versions.
This commit is contained in:
parent
f2274cad78
commit
9be5a63db3
@ -11,8 +11,7 @@ module SwaggerRails
|
|||||||
path = build_path(metadata[:path_template], params_data)
|
path = build_path(metadata[:path_template], params_data)
|
||||||
body_or_params = build_body_or_params(params_data)
|
body_or_params = build_body_or_params(params_data)
|
||||||
headers = build_headers(params_data, metadata[:consumes], metadata[:produces])
|
headers = build_headers(params_data, metadata[:consumes], metadata[:produces])
|
||||||
|
test.send(metadata[:http_verb], path, { params: body_or_params, headers: headers })
|
||||||
test.send(metadata[:http_verb], path, body_or_params, headers)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_response!(test, metadata)
|
def assert_response!(test, metadata)
|
||||||
|
|||||||
@ -36,7 +36,7 @@ module SwaggerRails
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'builds the path from values on the test object' do
|
it 'builds the path from values on the test object' do
|
||||||
expect(test).to have_received(:get).with('/resource/1', {}, {})
|
expect(test).to have_received(:get).with('/resource/1', { params: {}, headers: {} })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -53,9 +53,10 @@ module SwaggerRails
|
|||||||
|
|
||||||
it 'builds a body from value on the test object' do
|
it 'builds a body from value on the test object' do
|
||||||
expect(test).to have_received(:post).with(
|
expect(test).to have_received(:post).with(
|
||||||
'/resource',
|
'/resource', {
|
||||||
"{\"foo\":\"bar\"}",
|
params: "{\"foo\":\"bar\"}",
|
||||||
{ 'CONTENT_TYPE' => 'application/json' }
|
headers: { 'CONTENT_TYPE' => 'application/json' }
|
||||||
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -71,7 +72,7 @@ module SwaggerRails
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'builds query params from values on the test object' do
|
it 'builds query params from values on the test object' do
|
||||||
expect(test).to have_received(:get).with('/resource', { 'type' => 'foo' }, {})
|
expect(test).to have_received(:get).with('/resource', { params: { 'type' => 'foo' }, headers: {} })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -88,9 +89,10 @@ module SwaggerRails
|
|||||||
|
|
||||||
it 'builds request headers from values on the test object' do
|
it 'builds request headers from values on the test object' do
|
||||||
expect(test).to have_received(:get).with(
|
expect(test).to have_received(:get).with(
|
||||||
'/resource',
|
'/resource', {
|
||||||
{},
|
params: {},
|
||||||
{ 'Date' => '2000-01-01', 'ACCEPT' => 'application/json' }
|
headers: { 'Date' => '2000-01-01', 'ACCEPT' => 'application/json' }
|
||||||
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -106,7 +108,7 @@ module SwaggerRails
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'prepends the basePath to the request path' do
|
it 'prepends the basePath to the request path' do
|
||||||
expect(test).to have_received(:get).with('/api/resource', {}, {})
|
expect(test).to have_received(:get).with('/api/resource', { params: {}, headers: {} })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user