Permalink
Browse files

improve AUTO_BUFFER regexp. should probably use an explicite whitelis…

…t of all rails helpers here, though.
  • Loading branch information...
1 parent add057e commit 249cb4ec3c8814a4a2628f6698b1fb1fe95012e7 Sven Fuchs committed Jan 11, 2011
Showing with 10 additions and 3 deletions.
  1. +1 −1 lib/minimal/template.rb
  2. +9 −0 test/template_test.rb
  3. +0 −2 test/test_helper.rb
View
@@ -3,7 +3,7 @@ class Minimal::Template
autoload :Handler, 'minimal/template/handler'
autoload :TranslatedTags, 'minimal/template/translated_tags'
- AUTO_BUFFER = %r(render|tag|error_message_|select|debug|_to|[^l]_for)
+ AUTO_BUFFER = %r(^render|^error_message_|_select$|tag$|_to$|[^l]_for$|debug) # TODO explicitely whitelist helpers that return tags
TAG_NAMES = %w(abbr a body div em fieldset h1 h2 h3 h4 h5 h6 head html img input label li
link ol option p pre script select span strong table thead tbody tfoot td title th tr ul)
View
@@ -151,4 +151,13 @@ def template
template.instance_variable_set(:@locals, :foo => 'bar')
assert template.respond_to?(:foo)
end
+
+ test "autobuffers expected methods" do
+ methods = %w(
+ error_messages_for
+ )
+ methods.each do |method|
+ assert_match Minimal::Template::AUTO_BUFFER, method
+ end
+ end
end
View
@@ -1,5 +1,3 @@
-$:.unshift File.expand_path('../../lib', __FILE__)
-
require 'rubygems'
require 'test/unit'
require 'pp'

0 comments on commit 249cb4e

Please sign in to comment.