Skip to content

Commit

Permalink
Adds tests for content negotiation change introduced in dc5300a
Browse files Browse the repository at this point in the history
Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information
Patrik Stenmark authored and wycats committed Jul 4, 2010
1 parent 3cb5375 commit 7f7480f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions actionpack/test/controller/mime_responds_test.rb
Expand Up @@ -36,6 +36,15 @@ def html_or_xml
type.all { render :text => "Nothing" }
end
end

def json_xml_or_html
respond_to do |type|
type.json { render :text => 'JSON' }
type.xml { render :xml => 'XML' }
type.html { render :text => 'HTML' }
end
end


def forced_xml
request.format = :xml
Expand Down Expand Up @@ -364,6 +373,17 @@ def test_handle_any_any_xml
get :handle_any_any
assert_equal 'Whatever you ask for, I got it', @response.body
end

def test_browser_check_with_any_any
@request.accept = "application/json, application/xml"
get :json_xml_or_html
assert_equal 'JSON', @response.body

@request.accept = "application/json, application/xml, */*"
get :json_xml_or_html
assert_equal 'HTML', @response.body
end


def test_rjs_type_skips_layout
@request.accept = "text/javascript"
Expand Down

0 comments on commit 7f7480f

Please sign in to comment.