Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6808: json_symbol_test.diff

File json_symbol_test.diff, 1.0 kB (added by josh, 2 years ago)
  • test/controller/render_test.rb

    old new  
    4747    render_json({:hello => 'world'}.to_json, 'alert') 
    4848  end 
    4949 
     50  def render_symbol_json 
     51    render :json => {:hello => 'world'}.to_json 
     52  end 
     53 
    5054  def render_custom_code 
    5155    render_text "hello world", "404 Moved" 
    5256  end 
     
    125129      case action_name 
    126130        when "layout_test":         "layouts/standard" 
    127131        when "builder_layout_test": "layouts/builder" 
     132        when "render_symbol_json":  "layouts/standard" 
    128133      end 
    129134    end 
    130135end 
     
    184189    assert_equal 'application/json', @response.content_type 
    185190  end 
    186191 
     192  def test_do_with_render_symbol_json 
     193    get :render_symbol_json 
     194    assert_equal '{hello: "world"}', @response.body 
     195    assert_equal 'application/json', @response.content_type 
     196  end 
     197 
    187198  def test_do_with_render_custom_code 
    188199    get :render_custom_code 
    189200    assert_response 404