Created
January 8, 2009 11:20
-
-
Save djanowski/44688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# class TagsHelperTest < Test::Unit::TestCase | |
# helper 'app/helpers/tags' | |
# | |
# def test_tag | |
# assert_equal "<div></div>", helper.tag(:div) | |
# end | |
# end | |
require 'haml/engine' | |
module TestingHelpers | |
def self.included(base) | |
class << base | |
def helper(*path) | |
path[-1] = "#{path[-1]}.rb" | |
load root_path(*path) | |
end | |
end | |
end | |
def helper | |
@helper ||= HelperContext.new | |
end | |
class HelperContext | |
include Haml::Helpers | |
def initialize | |
init_haml_helpers | |
end | |
end | |
end | |
def helpers(&b) | |
TestingHelpers::HelperContext.class_eval(&b) | |
Sinatra::EventContext.class_eval(&b) | |
end | |
Test::Unit::TestCase.send(:include, TestingHelpers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment