Permalink
Browse files

More tests for alias_method_chain with feature and method punctuation.

…Closes #4954.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4920 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent b6afb28 commit 5dfec7b2179b273cc9475d40bfad01731903ea8c @jeremy jeremy committed Sep 3, 2006
Showing with 15 additions and 0 deletions.
  1. +15 −0 activesupport/test/core_ext/module_test.rb
@@ -175,4 +175,19 @@ def test_alias_method_chain_with_same_names_between_predicates_and_bang_methods
assert_equal false, @instance.quux?
assert_equal true, @instance.quux_without_baz?
end
+
+ def test_alias_method_chain_with_feature_punctuation
+ FooClassWithBarMethod.send(:define_method, 'quux', Proc.new { 'quux' })
+ FooClassWithBarMethod.send(:define_method, 'quux?', Proc.new { 'quux?' })
+ FooClassWithBarMethod.send(:include, BarMethodAliaser)
+
+ FooClassWithBarMethod.alias_method_chain :quux, :baz!
+ assert_nothing_raised do
+ assert_equal 'quux_with_baz!', @instance.quux_with_baz!
+ end
+
+ assert_raise(NameError) do
+ FooClassWithBarMethod.alias_method_chain :quux?, :baz!
+ end
+ end
end

0 comments on commit 5dfec7b

Please sign in to comment.