mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 17:50:13 +01:00
Changes you will need to make: * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install. Other notes on my changes: * Modified our code to take advantage of Rails 2.1's slick time zone support. * Upgraded will_paginate for compatibility * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
require 'abstract_unit'
|
|
|
|
class CustomHandler < ActionView::TemplateHandler
|
|
def initialize( view )
|
|
@view = view
|
|
end
|
|
|
|
def render( template )
|
|
[ template.source,
|
|
template.locals,
|
|
@view ]
|
|
end
|
|
end
|
|
|
|
class CustomHandlerTest < Test::Unit::TestCase
|
|
def setup
|
|
ActionView::Template.register_template_handler "foo", CustomHandler
|
|
ActionView::Template.register_template_handler :foo2, CustomHandler
|
|
@view = ActionView::Base.new
|
|
end
|
|
|
|
def test_custom_render
|
|
template = ActionView::InlineTemplate.new(@view, "hello <%= one %>", { :one => "two" }, "foo")
|
|
|
|
result = @view.render_template(template)
|
|
assert_equal(
|
|
[ "hello <%= one %>", { :one => "two" }, @view ],
|
|
result )
|
|
end
|
|
|
|
def test_custom_render2
|
|
template = ActionView::InlineTemplate.new(@view, "hello <%= one %>", { :one => "two" }, "foo2")
|
|
result = @view.render_template(template)
|
|
assert_equal(
|
|
[ "hello <%= one %>", { :one => "two" }, @view ],
|
|
result )
|
|
end
|
|
|
|
def test_unhandled_extension
|
|
# uses the ERb handler by default if the extension isn't recognized
|
|
template = ActionView::InlineTemplate.new(@view, "hello <%= one %>", { :one => "two" }, "bar")
|
|
result = @view.render_template(template)
|
|
assert_equal "hello two", result
|
|
end
|
|
end
|