vendor/plugins/haml/test/haml/template_test.rb in radiant-0.9.1 vs vendor/plugins/haml/test/haml/template_test.rb in radiant-1.0.0.rc1

- old
+ new

@@ -1,8 +1,7 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../test_helper' -require 'haml/template' require 'sass/plugin' require File.dirname(__FILE__) + '/mocks/article' require 'action_pack/version' @@ -192,10 +191,30 @@ def test_template_renders_should_eval assert_equal("2\n", render("= 1+1")) end + unless Haml::Util.ap_geq_3? + def test_form_for_error_return + assert_raise(Haml::Error) { render(<<HAML) } += form_for :article, @article, :url => '' do |f| + Title: + = f.text_field :title + Body: + = f.text_field :body +HAML + end + + def test_form_tag_error_return + assert_raise(Haml::Error) { render(<<HAML) } += form_tag '' do + Title: + Body: +HAML + end + end + def test_haml_options old_options = Haml::Template.options.dup Haml::Template.options[:suppress_eval] = true old_base, @base = @base, create_base assert_renders_correctly("eval_suppressed") @@ -259,11 +278,11 @@ if defined?(ActionView::OutputBuffer) && Haml::Util.has?(:instance_method, ActionView::OutputBuffer, :append_if_string=) def test_av_block_deprecation_warning assert_warning(/^DEPRECATION WARNING: - style block helpers are deprecated\. Please use =\./) do assert_equal <<HTML, render(<<HAML, :action_view) -<form action="" method="post"> +<form #{rails_form_attr}action="" method="post">#{rails_form_opener} Title: <input id="article_title" name="article[title]" size="30" type="text" value="Hello" /> Body: <input id="article_body" name="article[body]" size="30" type="text" value="World" /> </form> @@ -358,11 +377,11 @@ HAML end def test_xss_protection_with_form_for assert_equal(<<HTML, render(<<HAML, :action_view)) -<form action="" method="post"> +<form #{rails_form_attr}action="" method="post">#{rails_form_opener} Title: <input id="article_title" name="article[title]" size="30" type="text" value="Hello" /> Body: <input id="article_body" name="article[body]" size="30" type="text" value="World" /> </form> @@ -379,9 +398,20 @@ assert_equal(<<HTML, render(<<HAML, :action_view)) window.location.reload(); HTML = update_page do |p| - p.reload +HAML + end + + def test_cache + @base.controller = ActionController::Base.new + @base.controller.perform_caching = false + assert_equal(<<HTML, render(<<HAML, :action_view)) +Test +HTML +- cache do + Test HAML end end end