Namespace
Methods
S
T
Instance Public methods
setup()
# File actionpack/test/controller/render_json_test.rb, line 69
def setup
  # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
  # a more accurate simulation of what happens in "real life".
  super
  @controller.logger = ActiveSupport::Logger.new(nil)

  @request.host = "www.nextangle.com"
end
test_render_json()
# File actionpack/test/controller/render_json_test.rb, line 90
def test_render_json
  get :render_json_hello_world
  assert_equal '{"hello":"world"}', @response.body
  assert_equal 'application/json', @response.content_type
end
test_render_json_calls_to_json_from_object()
# File actionpack/test/controller/render_json_test.rb, line 132
def test_render_json_calls_to_json_from_object
  get :render_json_without_options
  assert_equal '{"a":"b"}', @response.body
end
test_render_json_forwards_extra_options()
# File actionpack/test/controller/render_json_test.rb, line 126
def test_render_json_forwards_extra_options
  get :render_json_with_extra_options
  assert_equal '{"a":"b"}', @response.body
  assert_equal 'application/json', @response.content_type
end
test_render_json_nil()
# File actionpack/test/controller/render_json_test.rb, line 78
def test_render_json_nil
  get :render_json_nil
  assert_equal 'null', @response.body
  assert_equal 'application/json', @response.content_type
end
test_render_json_render_to_string()
# File actionpack/test/controller/render_json_test.rb, line 84
def test_render_json_render_to_string
  get :render_json_render_to_string
  assert_equal '[]', @response.body
end
test_render_json_with_callback()
# File actionpack/test/controller/render_json_test.rb, line 102
def test_render_json_with_callback
  get :render_json_hello_world_with_callback, xhr: true
  assert_equal '/**/alert({"hello":"world"})', @response.body
  assert_equal 'text/javascript', @response.content_type
end
test_render_json_with_custom_content_type()
# File actionpack/test/controller/render_json_test.rb, line 108
def test_render_json_with_custom_content_type
  get :render_json_with_custom_content_type, xhr: true
  assert_equal '{"hello":"world"}', @response.body
  assert_equal 'text/javascript', @response.content_type
end
test_render_json_with_render_to_string()
# File actionpack/test/controller/render_json_test.rb, line 120
def test_render_json_with_render_to_string
  get :render_json_with_render_to_string
  assert_equal '{"hello":"partial html"}', @response.body
  assert_equal 'application/json', @response.content_type
end
test_render_json_with_status()
# File actionpack/test/controller/render_json_test.rb, line 96
def test_render_json_with_status
  get :render_json_hello_world_with_status
  assert_equal '{"hello":"world"}', @response.body
  assert_equal 401, @response.status
end
test_render_symbol_json()
# File actionpack/test/controller/render_json_test.rb, line 114
def test_render_symbol_json
  get :render_symbol_json
  assert_equal '{"hello":"world"}', @response.body
  assert_equal 'application/json', @response.content_type
end