mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Switch to Minitest
This way we're sure to be using the same test library on all Ruby versions and platforms.
This commit is contained in:
parent
500d28fb0f
commit
ea8b22f250
7 changed files with 20 additions and 18 deletions
|
@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|||
spec.add_development_dependency 'rails'
|
||||
spec.add_development_dependency 'ruby_parser'
|
||||
spec.add_development_dependency 'rbench'
|
||||
spec.add_development_dependency 'minitest'
|
||||
|
||||
spec.description = <<-END
|
||||
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
class EngineTest < Test::Unit::TestCase
|
||||
class EngineTest < MiniTest::Unit::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.
|
||||
|
@ -1434,7 +1434,7 @@ HAML
|
|||
end
|
||||
|
||||
def test_arbitrary_output_option
|
||||
assert_raise_message(Haml::Error, "Invalid output format :html1") do
|
||||
assert_raises_message(Haml::Error, "Invalid output format :html1") do
|
||||
engine("%br", :format => :html1)
|
||||
end
|
||||
end
|
||||
|
@ -1484,7 +1484,7 @@ HAML
|
|||
|
||||
# because anything before the doctype triggers quirks mode in IE
|
||||
def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html
|
||||
assert_no_match(/^\s+/, render("!!! xml\n!!!", :format => :html4))
|
||||
refute_match(/^\s+/, render("!!! xml\n!!!", :format => :html4))
|
||||
end
|
||||
|
||||
# HTML5
|
||||
|
|
|
@ -16,7 +16,7 @@ module Haml::Helpers
|
|||
end
|
||||
end
|
||||
|
||||
class HelperTest < Test::Unit::TestCase
|
||||
class HelperTest < MiniTest::Unit::TestCase
|
||||
Post = Struct.new('Post', :body, :error_field, :errors)
|
||||
class PostErrors
|
||||
def on(name)
|
||||
|
@ -289,19 +289,19 @@ HAML
|
|||
end
|
||||
|
||||
def test_haml_tag_raises_error_for_multiple_content
|
||||
assert_raise(Haml::Error) { render("- haml_tag :p, 'foo' do\n bar") }
|
||||
assert_raises(Haml::Error) { render("- haml_tag :p, 'foo' do\n bar") }
|
||||
end
|
||||
|
||||
def test_haml_tag_flags
|
||||
assert_equal("<p />\n", render("- haml_tag :p, :/"))
|
||||
assert_equal("<p>kumquat</p>\n", render("- haml_tag :p, :< do\n kumquat"))
|
||||
|
||||
assert_raise(Haml::Error) { render("- haml_tag :p, 'foo', :/") }
|
||||
assert_raise(Haml::Error) { render("- haml_tag :p, :/ do\n foo") }
|
||||
assert_raises(Haml::Error) { render("- haml_tag :p, 'foo', :/") }
|
||||
assert_raises(Haml::Error) { render("- haml_tag :p, :/ do\n foo") }
|
||||
end
|
||||
|
||||
def test_haml_tag_error_return
|
||||
assert_raise(Haml::Error) { render("= haml_tag :p") }
|
||||
assert_raises(Haml::Error) { render("= haml_tag :p") }
|
||||
end
|
||||
|
||||
def test_haml_tag_with_multiline_string
|
||||
|
@ -417,7 +417,7 @@ HAML
|
|||
end
|
||||
|
||||
def test_error_return
|
||||
assert_raise(Haml::Error, <<MESSAGE) {render("= haml_concat 'foo'")}
|
||||
assert_raises(Haml::Error, <<MESSAGE) {render("= haml_concat 'foo'")}
|
||||
haml_concat outputs directly to the Haml template.
|
||||
Disregard its return value and use the - operator,
|
||||
or use capture_haml to get the value as a String.
|
||||
|
|
|
@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper'
|
|||
require File.dirname(__FILE__) + '/html2haml/erb_tests'
|
||||
require 'haml/html'
|
||||
|
||||
class Html2HamlTest < Test::Unit::TestCase
|
||||
class Html2HamlTest < MiniTest::Unit::TestCase
|
||||
def test_empty_render_should_remain_empty
|
||||
assert_equal '', render('')
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ class DummyController
|
|||
end
|
||||
end
|
||||
|
||||
class TemplateTest < Test::Unit::TestCase
|
||||
class TemplateTest < MiniTest::Unit::TestCase
|
||||
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
|
||||
TEMPLATES = %w{ very_basic standard helpers
|
||||
whitespace_handling original_engine list helpful
|
||||
|
@ -194,7 +194,7 @@ class TemplateTest < Test::Unit::TestCase
|
|||
|
||||
unless Haml::Util.ap_geq_3?
|
||||
def test_form_for_error_return
|
||||
assert_raise(Haml::Error) { render(<<HAML) }
|
||||
assert_raises(Haml::Error) { render(<<HAML) }
|
||||
= form_for :article, @article, :url => '' do |f|
|
||||
Title:
|
||||
= f.text_field :title
|
||||
|
@ -204,7 +204,7 @@ HAML
|
|||
end
|
||||
|
||||
def test_form_tag_error_return
|
||||
assert_raise(Haml::Error) { render(<<HAML) }
|
||||
assert_raises(Haml::Error) { render(<<HAML) }
|
||||
= form_tag '' do
|
||||
Title:
|
||||
Body:
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
require "test/unit" # On JRuby, tests won't run unless we include this WTF
|
||||
require 'minitest/autorun'
|
||||
require 'action_pack'
|
||||
require 'action_controller'
|
||||
require 'action_view'
|
||||
|
@ -19,7 +21,6 @@ end
|
|||
|
||||
ActionController::Base.logger = Logger.new(nil)
|
||||
|
||||
require 'test/unit'
|
||||
require 'fileutils'
|
||||
require 'haml'
|
||||
|
||||
|
@ -27,7 +28,7 @@ require 'haml/template'
|
|||
Haml::Template.options[:ugly] = false
|
||||
Haml::Template.options[:format] = :xhtml
|
||||
|
||||
class Test::Unit::TestCase
|
||||
class MiniTest::Unit::TestCase
|
||||
def assert_warning(message)
|
||||
the_real_stderr, $stderr = $stderr, StringIO.new
|
||||
yield
|
||||
|
@ -73,7 +74,7 @@ class Test::Unit::TestCase
|
|||
'" type="hidden" value="' + char + '" /></div>'
|
||||
end
|
||||
|
||||
def assert_raise_message(klass, message)
|
||||
def assert_raises_message(klass, message)
|
||||
yield
|
||||
rescue Exception => e
|
||||
assert_instance_of(klass, e)
|
||||
|
@ -82,7 +83,7 @@ class Test::Unit::TestCase
|
|||
flunk "Expected exception #{klass}, none raised"
|
||||
end
|
||||
|
||||
def assert_raise_line(line)
|
||||
def assert_raises_line(line)
|
||||
yield
|
||||
rescue Sass::SyntaxError => e
|
||||
assert_equal(line, e.sass_line)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
require 'pathname'
|
||||
|
||||
class UtilTest < Test::Unit::TestCase
|
||||
class UtilTest < MiniTest::Unit::TestCase
|
||||
include Haml::Util
|
||||
|
||||
class Dumpable
|
||||
|
|
Loading…
Add table
Reference in a new issue