mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Better failing tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7630 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -133,7 +133,7 @@ class RespondToController < ActionController::Base
|
||||
protected
|
||||
def set_layout
|
||||
if ["all_types_with_layout", "iphone_with_html_response_type"].include?(action_name)
|
||||
"standard"
|
||||
"respond_to/layouts/standard"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -327,7 +327,7 @@ class MimeControllerTest < Test::Unit::TestCase
|
||||
def test_html_type_with_layout
|
||||
@request.env["HTTP_ACCEPT"] = "text/html"
|
||||
get :all_types_with_layout
|
||||
assert_equal '<html>HTML for all_types_with_layout</html>', @response.body
|
||||
assert_equal '<html><div id="html">HTML for all_types_with_layout</div></html>', @response.body
|
||||
end
|
||||
|
||||
def test_xhr
|
||||
@@ -396,17 +396,17 @@ class MimeControllerTest < Test::Unit::TestCase
|
||||
|
||||
def test_format_with_custom_response_type
|
||||
get :iphone_with_html_response_type
|
||||
assert_equal "<html>Hello future from Firefox!</html>", @response.body
|
||||
assert_equal '<html><div id="html">Hello future from Firefox!</div></html>', @response.body
|
||||
|
||||
get :iphone_with_html_response_type, :format => "iphone"
|
||||
assert_equal "text/html", @response.content_type
|
||||
assert_equal "<html>Hello iPhone future from iPhone!</html>", @response.body
|
||||
assert_equal '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body
|
||||
end
|
||||
|
||||
def test_format_with_custom_response_type_and_request_headers
|
||||
@request.env["HTTP_ACCEPT"] = "text/iphone"
|
||||
get :iphone_with_html_response_type
|
||||
assert_equal "<html>Hello future from iPhone!</html>", @response.body
|
||||
assert_equal '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
end
|
||||
|
||||
1
actionpack/test/fixtures/respond_to/layouts/standard.html.erb
vendored
Normal file
1
actionpack/test/fixtures/respond_to/layouts/standard.html.erb
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<html><div id="html"><%= yield %></div></html>
|
||||
@@ -1 +0,0 @@
|
||||
<html><%= @content_for_layout %></html>
|
||||
Reference in New Issue
Block a user