Namespace
Methods
- T
Instance Public methods
test_encoding_as_json()
Link
# File actionpack/test/controller/integration_test.rb, line 1150 def test_encoding_as_json post_to_foos as: :json do assert_response :success assert_match 'foos_json.json', request.path assert_equal 'application/json', request.content_type assert_equal({ 'foo' => 'fighters' }, request.request_parameters) assert_equal({ 'foo' => 'fighters' }, response.parsed_body) end end
test_encoding_as_without_mime_registration()
Link
test_parsed_body_without_as_option()
Link
# File actionpack/test/controller/integration_test.rb, line 1183 def test_parsed_body_without_as_option with_routing do |routes| routes.draw do ActiveSupport::Deprecation.silence do get ':action' => FooController end end get '/foos_json.json', params: { foo: 'heyo' } assert_equal({ 'foo' => 'heyo' }, response.parsed_body) end end
test_registering_custom_encoder()
Link
# File actionpack/test/controller/integration_test.rb, line 1166 def test_registering_custom_encoder Mime::Type.register 'text/wibble', :wibble ActionDispatch::IntegrationTest.register_encoder(:wibble, param_encoder: -> params { params }) post_to_foos as: :wibble do assert_response :success assert_match 'foos_wibble.wibble', request.path assert_equal 'text/wibble', request.content_type assert_equal Hash.new, request.request_parameters # Unregistered MIME Type can't be parsed. assert_equal 'ok', response.parsed_body end ensure Mime::Type.unregister :wibble end