aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-08 15:23:39 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-08 15:23:39 -0700
commit7d89a9f00a55f545cf027d1d81c22eb3e9eab6d0 (patch)
treee1bc71f8524b40feb07f4ae281f1a2359e18a15c
parentece76f3840fb0327e58f91d6091beb66801deaed (diff)
downloadrails-7d89a9f00a55f545cf027d1d81c22eb3e9eab6d0.tar.gz
rails-7d89a9f00a55f545cf027d1d81c22eb3e9eab6d0.tar.bz2
rails-7d89a9f00a55f545cf027d1d81c22eb3e9eab6d0.zip
adding a class conditional test
-rw-r--r--activesupport/test/callbacks_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index b48145aab7..0a29dd21c8 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -813,6 +813,18 @@ module CallbacksTest
}
end
+ # FIXME: do we really want to support classes as conditionals? There were
+ # no tests for it previous to this.
+ def test_class
+ z = []
+ klass = build_class Class.new {
+ define_singleton_method(:before) { |o| z << o }
+ }
+ object = klass.new
+ object.run
+ assert_equal [object], z
+ end
+
def test_proc_negative_arity # passes an empty list if *args
z = []
object = build_class(->(*args) { z << args }).new