aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/render_test.rb20
-rw-r--r--actionpack/test/fixtures/test/formatted_html_erb.html.erb1
-rw-r--r--actionpack/test/fixtures/test/formatted_xml_erb.builder1
-rw-r--r--actionpack/test/fixtures/test/formatted_xml_erb.html.erb1
-rw-r--r--actionpack/test/fixtures/test/formatted_xml_erb.xml.erb1
-rw-r--r--actionpack/test/template/base_test.rb9
6 files changed, 33 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 8c2b57084c..7175b4f798 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -122,6 +122,12 @@ class TestController < ActionController::Base
ActionView::Base.local_assigns_support_string_keys = false
end
+ def formatted_html_erb
+ end
+
+ def formatted_xml_erb
+ end
+
def render_to_string_test
@foo = render_to_string :inline => "this is a test"
end
@@ -341,6 +347,20 @@ class RenderTest < Test::Unit::TestCase
assert_equal etag_for("<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n"), @response.headers['ETag']
end
+ def test_should_render_formatted_template
+ get :formatted_html_erb
+ assert_equal 'formatted html erb', @response.body
+ end
+
+ def test_should_render_formatted_xml_erb_template
+ get :formatted_xml_erb, :format => :xml
+ assert_equal '<test>passed formatted xml erb</test>', @response.body
+ end
+
+ def test_should_render_formatted_html_erb_template
+ get :formatted_xml_erb
+ assert_equal '<test>passed formatted html erb</test>', @response.body
+ end
protected
def assert_deprecated_render(&block)
diff --git a/actionpack/test/fixtures/test/formatted_html_erb.html.erb b/actionpack/test/fixtures/test/formatted_html_erb.html.erb
new file mode 100644
index 0000000000..1c64efabd8
--- /dev/null
+++ b/actionpack/test/fixtures/test/formatted_html_erb.html.erb
@@ -0,0 +1 @@
+formatted html erb \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/formatted_xml_erb.builder b/actionpack/test/fixtures/test/formatted_xml_erb.builder
new file mode 100644
index 0000000000..14fd3549fb
--- /dev/null
+++ b/actionpack/test/fixtures/test/formatted_xml_erb.builder
@@ -0,0 +1 @@
+xml.test 'failed' \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/formatted_xml_erb.html.erb b/actionpack/test/fixtures/test/formatted_xml_erb.html.erb
new file mode 100644
index 0000000000..0c855a604b
--- /dev/null
+++ b/actionpack/test/fixtures/test/formatted_xml_erb.html.erb
@@ -0,0 +1 @@
+<test>passed formatted html erb</test> \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb b/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb
new file mode 100644
index 0000000000..6ca09d5304
--- /dev/null
+++ b/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb
@@ -0,0 +1 @@
+<test>passed formatted xml erb</test> \ No newline at end of file
diff --git a/actionpack/test/template/base_test.rb b/actionpack/test/template/base_test.rb
index 754c38f393..ec35f82dde 100644
--- a/actionpack/test/template/base_test.rb
+++ b/actionpack/test/template/base_test.rb
@@ -14,14 +14,22 @@ class ActionViewTemplateTest < Test::Unit::TestCase
assert_equal :foo, @template.send(:find_template_extension_for, 'foo')
end
+ def test_should_find_formatted_erb_extension
+ @template.expects(:delegate_template_exists?).with('foo').returns(nil)
+ @template.expects(:formatted_template_exists?).with('foo.html').returns("erb")
+ assert_equal "html.erb", @template.send(:find_template_extension_for, 'foo')
+ end
+
def test_should_find_erb_extension
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
+ @template.expects(:formatted_template_exists?).with('foo.html').returns(nil)
@template.expects(:erb_template_exists?).with('foo').returns(:erb)
assert_equal :erb, @template.send(:find_template_extension_for, 'foo')
end
def test_should_find_builder_extension
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
+ @template.expects(:formatted_template_exists?).with('foo.html').returns(nil)
@template.expects(:erb_template_exists?).with('foo').returns(nil)
@template.expects(:builder_template_exists?).with('foo').returns(:builder)
assert_equal :builder, @template.send(:find_template_extension_for, 'foo')
@@ -29,6 +37,7 @@ class ActionViewTemplateTest < Test::Unit::TestCase
def test_should_find_javascript_extension
@template.expects(:delegate_template_exists?).with('foo').returns(nil)
+ @template.expects(:formatted_template_exists?).with('foo.html').returns(nil)
@template.expects(:erb_template_exists?).with('foo').returns(nil)
@template.expects(:builder_template_exists?).with('foo').returns(nil)
@template.expects(:javascript_template_exists?).with('foo').returns(true)