aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/body_parts_test.rb25
-rw-r--r--actionpack/test/template/test_case_test.rb4
-rw-r--r--actionpack/test/template/text_helper_test.rb108
3 files changed, 4 insertions, 133 deletions
diff --git a/actionpack/test/template/body_parts_test.rb b/actionpack/test/template/body_parts_test.rb
deleted file mode 100644
index 69cf684083..0000000000
--- a/actionpack/test/template/body_parts_test.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'abstract_unit'
-
-class BodyPartsTest < ActionController::TestCase
- RENDERINGS = [Object.new, Object.new, Object.new]
-
- class TestController < ActionController::Base
- def response_body() "" end
-
- def index
- RENDERINGS.each do |rendering|
- view_context.punctuate_body! rendering
- end
- end
- end
-
- tests TestController
-
- def test_body_parts
- get :index
- # TestProcess buffers body_parts into body
- # TODO: Rewrite test w/o going through process
- assert_equal RENDERINGS, @response.body_parts
- assert_equal RENDERINGS.join, @response.body
- end
-end
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index 16e5ee4f72..9b50ea8a42 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -37,6 +37,10 @@ module ActionView
include SharedTests
test_case = self
+ test "memoizes the _view" do
+ assert_same _view, _view
+ end
+
test "works without testing a helper module" do
assert_equal 'Eloy', render('developers/developer', :developer => stub(:name => 'Eloy'))
end
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index 64f1d46413..17fc8b6edd 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -1,17 +1,6 @@
# encoding: us-ascii
require 'abstract_unit'
require 'testing_sandbox'
-begin
- require 'redcloth'
-rescue LoadError
- $stderr.puts "Skipping textilize tests. `gem install RedCloth` to enable."
-end
-
-begin
- require 'bluecloth'
-rescue LoadError
- $stderr.puts "Skipping markdown tests. 'gem install bluecloth' to enable."
-end
class TextHelperTest < ActionView::TestCase
tests ActionView::Helpers::TextHelper
@@ -665,101 +654,4 @@ class TextHelperTest < ActionView::TestCase
assert_equal("red", cycle("red", "blue"))
assert_equal(%w{Specialized Fuji Giant}, @cycles)
end
-
- # TODO test textilize_without_paragraph and markdown
- if defined? RedCloth
- def test_textilize_should_be_html_safe
- assert textilize("*This is Textile!* Rejoice!").html_safe?
- end
-
- def test_textilize
- assert_equal("<p><strong>This is Textile!</strong> Rejoice!</p>", textilize("*This is Textile!* Rejoice!"))
- end
-
- def test_textilize_with_blank
- assert_equal("", textilize(""))
- end
-
- def test_textilize_with_options
- assert_equal("<p>This is worded &lt;strong&gt;strongly&lt;/strong&gt;</p>", textilize("This is worded <strong>strongly</strong>", :filter_html))
- end
-
- def test_textilize_should_sanitize_unsafe_input
- assert_equal("<p>This is worded <strong>strongly</strong></p>", textilize("This is worded <strong>strongly</strong><script>code!</script>"))
- end
-
- def test_textilize_should_not_sanitize_input_if_safe_option
- assert_equal("<p>This is worded <strong>strongly</strong><script>code!</script></p>", textilize("This is worded <strong>strongly</strong><script>code!</script>", :safe))
- end
-
- def test_textilize_should_not_sanitize_safe_input
- assert_equal("<p>This is worded <strong>strongly</strong><script>code!</script></p>", textilize("This is worded <strong>strongly</strong><script>code!</script>".html_safe))
- end
-
- def test_textilize_with_hard_breaks
- assert_equal("<p>This is one scary world.<br />\n True.</p>", textilize("This is one scary world.\n True."))
- end
-
- def test_textilize_without_paragraph_should_be_html_safe
- textilize_without_paragraph("*This is Textile!* Rejoice!").html_safe?
- end
-
- def test_textilize_without_paragraph
- assert_equal("<strong>This is Textile!</strong> Rejoice!", textilize_without_paragraph("*This is Textile!* Rejoice!"))
- end
-
- def test_textilize_without_paragraph_with_blank
- assert_equal("", textilize_without_paragraph(""))
- end
-
- def test_textilize_without_paragraph_with_options
- assert_equal("This is worded &lt;strong&gt;strongly&lt;/strong&gt;", textilize_without_paragraph("This is worded <strong>strongly</strong>", :filter_html))
- end
-
- def test_textilize_without_paragraph_should_sanitize_unsafe_input
- assert_equal("This is worded <strong>strongly</strong>", textilize_without_paragraph("This is worded <strong>strongly</strong><script>code!</script>"))
- end
-
- def test_textilize_without_paragraph_should_not_sanitize_input_if_safe_option
- assert_equal("This is worded <strong>strongly</strong><script>code!</script>", textilize_without_paragraph("This is worded <strong>strongly</strong><script>code!</script>", :safe))
- end
-
- def test_textilize_without_paragraph_should_not_sanitize_safe_input
- assert_equal("This is worded <strong>strongly</strong><script>code!</script>", textilize_without_paragraph("This is worded <strong>strongly</strong><script>code!</script>".html_safe))
- end
-
- def test_textilize_without_paragraph_with_hard_breaks
- assert_equal("This is one scary world.<br />\n True.", textilize_without_paragraph("This is one scary world.\n True."))
- end
- end
-
- if defined? BlueCloth
- def test_markdown_should_be_html_safe
- assert markdown("We are using __Markdown__ now!").html_safe?
- end
-
- def test_markdown
- assert_equal("<p>We are using <strong>Markdown</strong> now!</p>", markdown("We are using __Markdown__ now!"))
- end
-
- def test_markdown_with_blank
- assert_equal("", markdown(""))
- end
-
- def test_markdown_should_sanitize_unsafe_input
- assert_equal("<p>This is worded <strong>strongly</strong></p>", markdown("This is worded <strong>strongly</strong><script>code!</script>"))
- end
-
- def test_markdown_should_not_sanitize_input_if_safe_option
- assert_equal("<p>This is worded <strong>strongly</strong><script>code!</script></p>", markdown("This is worded <strong>strongly</strong><script>code!</script>", :safe))
- end
-
- def test_markdown_should_not_sanitize_safe_input
- assert_equal("<p>This is worded <strong>strongly</strong><script>code!</script></p>", markdown("This is worded <strong>strongly</strong><script>code!</script>".html_safe))
- end
-
- def test_markdown_with_hard_breaks
- assert_equal("<p>This is one scary world.</p>\n\n<p>True.</p>", markdown("This is one scary world.\n\nTrue."))
- end
- end
end