aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-05-29 17:03:23 -0500
committerJoshua Peek <josh@joshpeek.com>2009-05-29 17:03:23 -0500
commit669fd84910586d4c791b6f5bf4320f68ac7845aa (patch)
treeec246bdf6fe6fc61219c59837c4bec07ba19e267 /activesupport
parentc7c35be8fe30b3e29a5d05edae767f7d6a286911 (diff)
downloadrails-669fd84910586d4c791b6f5bf4320f68ac7845aa.tar.gz
rails-669fd84910586d4c791b6f5bf4320f68ac7845aa.tar.bz2
rails-669fd84910586d4c791b6f5bf4320f68ac7845aa.zip
AS::Concern redefines "include" to lazy include modules as dependencies
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/concern.rb2
-rw-r--r--activesupport/test/concern_test.rb6
2 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb
index a09a2420b3..dcf1e8152f 100644
--- a/activesupport/lib/active_support/concern.rb
+++ b/activesupport/lib/active_support/concern.rb
@@ -19,5 +19,7 @@ module ActiveSupport
super
end
end
+
+ alias_method :include, :depends_on
end
end
diff --git a/activesupport/test/concern_test.rb b/activesupport/test/concern_test.rb
index 40fcb7c57f..4cbe56a2d2 100644
--- a/activesupport/test/concern_test.rb
+++ b/activesupport/test/concern_test.rb
@@ -34,7 +34,7 @@ class ConcernTest < Test::Unit::TestCase
module Bar
extend ActiveSupport::Concern
- depends_on Baz
+ include Baz
def bar
"bar"
@@ -48,7 +48,7 @@ class ConcernTest < Test::Unit::TestCase
module Foo
extend ActiveSupport::Concern
- depends_on Bar, Baz
+ include Bar, Baz
end
def setup
@@ -90,7 +90,7 @@ class ConcernTest < Test::Unit::TestCase
assert @klass.included_modules.include?(ConcernTest::Bar)
end
- def test_depends_on_with_multiple_modules
+ def test_dependencies_with_multiple_modules
@klass.send(:include, Foo)
assert_equal [ConcernTest::Foo, ConcernTest::Bar, ConcernTest::Baz::InstanceMethods, ConcernTest::Baz], @klass.included_modules[0..3]
end