parent
11ae151034
commit
51b29d53e2
@ -1 +1,2 @@
|
||||
haml-3.1.7.gem/haml-4.0.5.gem
|
||||
/haml-4.0.7.gem
|
||||
|
@ -1,169 +0,0 @@
|
||||
diff --git a/test/engine_test.rb b/test/engine_test.rb
|
||||
index 3b47217..5049340 100644
|
||||
--- a/test/engine_test.rb
|
||||
+++ b/test/engine_test.rb
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
require 'test_helper'
|
||||
|
||||
-class EngineTest < MiniTest::Unit::TestCase
|
||||
+class EngineTest < Haml::TestCase
|
||||
# A map of erroneous Haml documents to the error messages they should produce.
|
||||
# The error messages may be arrays;
|
||||
# if so, the second element should be the line number that should be reported for the error.
|
||||
diff --git a/test/filters_test.rb b/test/filters_test.rb
|
||||
index 5f16d2e..ca767ed 100644
|
||||
--- a/test/filters_test.rb
|
||||
+++ b/test/filters_test.rb
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
-class FiltersTest < MiniTest::Unit::TestCase
|
||||
+class FiltersTest < Haml::TestCase
|
||||
test "should be registered as filters when including Haml::Filters::Base" do
|
||||
begin
|
||||
refute Haml::Filters.defined.has_key? "bar"
|
||||
@@ -116,7 +116,7 @@ class FiltersTest < MiniTest::Unit::TestCase
|
||||
|
||||
end
|
||||
|
||||
-class ErbFilterTest < MiniTest::Unit::TestCase
|
||||
+class ErbFilterTest < Haml::TestCase
|
||||
test "multiline expressions should work" do
|
||||
html = "foobarbaz\n"
|
||||
haml = %Q{:erb\n <%= "foo" +\n "bar" +\n "baz" %>}
|
||||
@@ -137,7 +137,7 @@ class ErbFilterTest < MiniTest::Unit::TestCase
|
||||
|
||||
end
|
||||
|
||||
-class JavascriptFilterTest < MiniTest::Unit::TestCase
|
||||
+class JavascriptFilterTest < Haml::TestCase
|
||||
test "should interpolate" do
|
||||
scope = Object.new.instance_eval {foo = "bar"; nil if foo; binding}
|
||||
haml = ":javascript\n \#{foo}"
|
||||
@@ -183,7 +183,7 @@ class JavascriptFilterTest < MiniTest::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
-class CSSFilterTest < MiniTest::Unit::TestCase
|
||||
+class CSSFilterTest < Haml::TestCase
|
||||
test "should wrap output in CDATA and a CSS tag when output is XHTML" do
|
||||
html = "<style type='text/css'>\n /*<![CDATA[*/\n foo\n /*]]>*/\n</style>\n"
|
||||
haml = ":css\n foo"
|
||||
@@ -222,7 +222,7 @@ class CSSFilterTest < MiniTest::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
-class CDATAFilterTest < MiniTest::Unit::TestCase
|
||||
+class CDATAFilterTest < Haml::TestCase
|
||||
test "should wrap output in CDATA tag" do
|
||||
html = "<![CDATA[\n foo\n]]>\n"
|
||||
haml = ":cdata\n foo"
|
||||
@@ -230,7 +230,7 @@ class CDATAFilterTest < MiniTest::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
-class EscapedFilterTest < MiniTest::Unit::TestCase
|
||||
+class EscapedFilterTest < Haml::TestCase
|
||||
test "should escape ampersands" do
|
||||
html = "&\n"
|
||||
haml = ":escaped\n &"
|
||||
@@ -238,7 +238,7 @@ class EscapedFilterTest < MiniTest::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
-class RubyFilterTest < MiniTest::Unit::TestCase
|
||||
+class RubyFilterTest < Haml::TestCase
|
||||
test "can write to haml_io" do
|
||||
haml = ":ruby\n haml_io.puts 'hello'\n"
|
||||
html = "hello\n"
|
||||
@@ -256,4 +256,4 @@ class RubyFilterTest < MiniTest::Unit::TestCase
|
||||
html = "7\n"
|
||||
assert_equal(html, render(haml))
|
||||
end
|
||||
-end
|
||||
\ No newline at end of file
|
||||
+end
|
||||
diff --git a/test/helper_test.rb b/test/helper_test.rb
|
||||
index bf6b718..c845436 100644
|
||||
--- a/test/helper_test.rb
|
||||
+++ b/test/helper_test.rb
|
||||
@@ -27,6 +27,6 @@ class FormModel
|
||||
end
|
||||
|
||||
-class HelperTest < MiniTest::Unit::TestCase
|
||||
+class HelperTest < Haml::TestCase
|
||||
Post = Struct.new('Post', :body, :error_field, :errors)
|
||||
class PostErrors
|
||||
def on(name)
|
||||
diff --git a/test/parser_test.rb b/test/parser_test.rb
|
||||
index 3435562..b11c075 100644
|
||||
--- a/test/parser_test.rb
|
||||
+++ b/test/parser_test.rb
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
module Haml
|
||||
- class ParserTest < MiniTest::Unit::TestCase
|
||||
+ class ParserTest < Haml::TestCase
|
||||
|
||||
test "should raise error for 'else' at wrong indent level" do
|
||||
begin
|
||||
@@ -124,4 +124,4 @@ module Haml
|
||||
parser.parse
|
||||
end
|
||||
end
|
||||
-end
|
||||
\ No newline at end of file
|
||||
+end
|
||||
diff --git a/test/template_test.rb b/test/template_test.rb
|
||||
index 59ccd75..0c8e636 100644
|
||||
--- a/test/template_test.rb
|
||||
+++ b/test/template_test.rb
|
||||
@@ -38,7 +38,7 @@ class DummyController
|
||||
end
|
||||
end
|
||||
|
||||
-class TemplateTest < MiniTest::Unit::TestCase
|
||||
+class TemplateTest < Haml::TestCase
|
||||
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
|
||||
TEMPLATES = %w{ very_basic standard helpers
|
||||
whitespace_handling original_engine list helpful
|
||||
diff --git a/test/test_helper.rb b/test/test_helper.rb
|
||||
index 5119945..394e7eb 100644
|
||||
--- a/test/test_helper.rb
|
||||
+++ b/test/test_helper.rb
|
||||
@@ -41,14 +41,19 @@ require 'haml/template'
|
||||
Haml::Template.options[:ugly] = false
|
||||
Haml::Template.options[:format] = :xhtml
|
||||
|
||||
+BASE_TEST_CLASS = if defined?(Minitest::Test)
|
||||
+ Minitest::Test
|
||||
+ else
|
||||
+ MiniTest::Unit::TestCase
|
||||
+ end
|
||||
+
|
||||
module Declarative
|
||||
def test(name, &block)
|
||||
define_method("test #{name}", &block)
|
||||
end
|
||||
end
|
||||
|
||||
-class MiniTest::Unit::TestCase
|
||||
-
|
||||
+class Haml::TestCase < BASE_TEST_CLASS
|
||||
extend Declarative
|
||||
|
||||
def render(text, options = {}, base = nil, &block)
|
||||
diff --git a/test/util_test.rb b/test/util_test.rb
|
||||
index 5c9222a..481decf 100644
|
||||
--- a/test/util_test.rb
|
||||
+++ b/test/util_test.rb
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'test_helper'
|
||||
|
||||
-class UtilTest < MiniTest::Unit::TestCase
|
||||
+class UtilTest < Haml::TestCase
|
||||
include Haml::Util
|
||||
|
||||
def test_powerset
|
@ -0,0 +1,130 @@
|
||||
From 1f8821ce8bea3d36b1b7fa01730dff5ec0c0377c Mon Sep 17 00:00:00 2001
|
||||
From: Norman Clarke <norman@njclarke.com>
|
||||
Date: Mon, 8 Jun 2015 14:55:59 -0300
|
||||
Subject: [PATCH] Drop support for Rails 3.
|
||||
|
||||
---
|
||||
lib/haml/helpers/action_view_mods.rb | 8 ++---
|
||||
lib/haml/template/plugin.rb | 2 -
|
||||
test/helper_test.rb | 52 ++++++++++++-----------------------
|
||||
3 files changed, 23 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb
|
||||
index b17429d..ad0c13c 100644
|
||||
--- a/lib/haml/helpers/action_view_mods.rb
|
||||
+++ b/lib/haml/helpers/action_view_mods.rb
|
||||
@@ -87,11 +87,9 @@ def is_haml?
|
||||
end
|
||||
end
|
||||
|
||||
- if ActionPack::VERSION::MAJOR == 4
|
||||
- module Tags
|
||||
- class TextArea
|
||||
- include HamlSupport
|
||||
- end
|
||||
+ module Tags
|
||||
+ class TextArea
|
||||
+ include HamlSupport
|
||||
end
|
||||
end
|
||||
|
||||
diff --git a/lib/haml/template/plugin.rb b/lib/haml/template/plugin.rb
|
||||
index 322e445..6d96aae 100644
|
||||
--- a/lib/haml/template/plugin.rb
|
||||
+++ b/lib/haml/template/plugin.rb
|
||||
@@ -16,7 +16,7 @@ def handles_encoding?; true; end
|
||||
|
||||
def compile(template)
|
||||
options = Haml::Template.options.dup
|
||||
- if (ActionPack::VERSION::MAJOR >= 4) && template.respond_to?(:type)
|
||||
+ if template.respond_to?(:type)
|
||||
options[:mime_type] = template.type
|
||||
elsif template.respond_to? :mime_type
|
||||
options[:mime_type] = template.mime_type
|
||||
diff --git a/test/helper_test.rb b/test/helper_test.rb
|
||||
index f6293a8..b1f9701 100644
|
||||
--- a/test/helper_test.rb
|
||||
+++ b/test/helper_test.rb
|
||||
@@ -27,6 +27,8 @@
|
||||
end
|
||||
|
||||
class HelperTest < MiniTest::Unit::TestCase
|
||||
+ TEXT_AREA_CONTENT_REGEX = /<(textarea)[^>]*>\n(.*?)<\/\1>/im
|
||||
+
|
||||
Post = Struct.new('Post', :body, :error_field, :errors)
|
||||
class PostErrors
|
||||
def on(name)
|
||||
@@ -157,29 +159,15 @@ def test_pre
|
||||
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
|
||||
end
|
||||
|
||||
- # Rails >= 3.2.3 adds a newline after opening textarea tags.
|
||||
- def self.rails_text_area_helpers_emit_a_newline?
|
||||
- major, minor, tiny = ActionPack::VERSION::MAJOR, ActionPack::VERSION::MINOR, ActionPack::VERSION::TINY
|
||||
- major == 4 || ((major == 3) && (minor >= 2) && (tiny >= 3))
|
||||
- end
|
||||
-
|
||||
- def text_area_content_regex
|
||||
- @text_area_content_regex ||= if self.class.rails_text_area_helpers_emit_a_newline?
|
||||
- /<(textarea)[^>]*>\n(.*?)<\/\1>/im
|
||||
- else
|
||||
- /<(textarea)[^>]*>(.*?)<\/\1>/im
|
||||
- end
|
||||
- end
|
||||
-
|
||||
def test_text_area_tag
|
||||
output = render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
assert_equal "Foo
Bar
 Baz
 Boom", match_data[2]
|
||||
end
|
||||
|
||||
def test_text_area
|
||||
output = render('= text_area :post, :body', :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
assert_equal "Foo bar
baz", match_data[2]
|
||||
end
|
||||
|
||||
@@ -187,26 +175,24 @@ def test_partials_should_not_cause_textareas_to_be_indented
|
||||
# non-indentation of textareas rendered inside partials
|
||||
@base.instance_variable_set('@post', Post.new("Foo", nil, PostErrors.new))
|
||||
output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
assert_equal 'Foo', match_data[2]
|
||||
end
|
||||
|
||||
- if rails_text_area_helpers_emit_a_newline?
|
||||
- def test_textareas_should_prerve_leading_whitespace
|
||||
- # leading whitespace preservation
|
||||
- @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
- output = render(".foo\n = text_area :post, :body", :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
- assert_equal '  Foo', match_data[2]
|
||||
- end
|
||||
-
|
||||
- def test_textareas_should_prerve_leading_whitespace_in_partials
|
||||
- # leading whitespace in textareas rendered inside partials
|
||||
- @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
- output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
- assert_equal '  Foo', match_data[2]
|
||||
- end
|
||||
+ def test_textareas_should_prerve_leading_whitespace
|
||||
+ # leading whitespace preservation
|
||||
+ @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
+ output = render(".foo\n = text_area :post, :body", :action_view)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
+ assert_equal '  Foo', match_data[2]
|
||||
+ end
|
||||
+
|
||||
+ def test_textareas_should_prerve_leading_whitespace_in_partials
|
||||
+ # leading whitespace in textareas rendered inside partials
|
||||
+ @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
+ output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
+ assert_equal '  Foo', match_data[2]
|
||||
end
|
||||
|
||||
def test_capture_haml
|
Loading…
Reference in new issue