aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2011-03-27 11:20:54 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2011-03-27 11:20:54 -0700
commitcc6fa2f4d718c2d7a990fe23c38fc0ea4f2391d9 (patch)
tree787cd8bc8c61aced53088b45c469be7606df52aa
parenta9d27c04abf24dc85be061ff9772d71897af02b1 (diff)
downloadrails-cc6fa2f4d718c2d7a990fe23c38fc0ea4f2391d9.tar.gz
rails-cc6fa2f4d718c2d7a990fe23c38fc0ea4f2391d9.tar.bz2
rails-cc6fa2f4d718c2d7a990fe23c38fc0ea4f2391d9.zip
Fix alias_method, add test
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb2
-rw-r--r--actionpack/test/template/javascript_helper_test.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 6eda23a9a3..a19ba7a968 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -58,7 +58,7 @@ module ActionView
end
end
- alias_method :escape_javascript, :j
+ alias_method :j, :escape_javascript
# Returns a JavaScript tag with the +content+ inside. Example:
# javascript_tag "alert('All is good')"
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb
index 2e7484afaf..8aa2730da1 100644
--- a/actionpack/test/template/javascript_helper_test.rb
+++ b/actionpack/test/template/javascript_helper_test.rb
@@ -27,6 +27,7 @@ class JavaScriptHelperTest < ActionView::TestCase
assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos'))
assert_equal %(backslash\\\\test), escape_javascript( %(backslash\\test) )
assert_equal %(dont <\\/close> tags), escape_javascript(%(dont </close> tags))
+ assert_equal %(dont <\\/close> tags), j(%(dont </close> tags))
end
def test_button_to_function