diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-05-07 10:29:22 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-05-07 10:29:22 -0500 |
commit | 2854535b02bcee3668bda02c76c3105fc24730d3 (patch) | |
tree | b78660942bdc6f532a1109da57ee40d7d31cf603 /activesupport/test | |
parent | 783deae99a4850f597135146b19e7ee4622da94e (diff) | |
download | rails-2854535b02bcee3668bda02c76c3105fc24730d3.tar.gz rails-2854535b02bcee3668bda02c76c3105fc24730d3.tar.bz2 rails-2854535b02bcee3668bda02c76c3105fc24730d3.zip |
Make module dependency DSL opt in
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/dependency_module_test.rb (renamed from activesupport/test/core_ext/module/setup_test.rb) | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/activesupport/test/core_ext/module/setup_test.rb b/activesupport/test/dependency_module_test.rb index 132790f2ff..d611b4056c 100644 --- a/activesupport/test/core_ext/module/setup_test.rb +++ b/activesupport/test/dependency_module_test.rb @@ -1,9 +1,10 @@ require 'abstract_unit' -require 'active_support/core/time' -require 'active_support/core_ext/module/setup' +require 'active_support/dependency_module' -class SetupTest < Test::Unit::TestCase +class DependencyModuleTest < Test::Unit::TestCase module Baz + extend ActiveSupport::DependencyModule + module ClassMethods def baz "baz" @@ -28,6 +29,8 @@ class SetupTest < Test::Unit::TestCase end module Bar + extend ActiveSupport::DependencyModule + depends_on Baz def bar @@ -44,31 +47,31 @@ class SetupTest < Test::Unit::TestCase end def test_module_is_included_normally - @klass.use(Baz) + @klass.send(:include, Baz) assert_equal "baz", @klass.new.baz - assert_equal SetupTest::Baz, @klass.included_modules[0] + assert_equal DependencyModuleTest::Baz, @klass.included_modules[0] - @klass.use(Baz) + @klass.send(:include, Baz) assert_equal "baz", @klass.new.baz - assert_equal SetupTest::Baz, @klass.included_modules[0] + assert_equal DependencyModuleTest::Baz, @klass.included_modules[0] end def test_class_methods_are_extended - @klass.use(Baz) + @klass.send(:include, Baz) assert_equal "baz", @klass.baz - assert_equal SetupTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0] + assert_equal DependencyModuleTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0] end def test_setup_block_is_ran - @klass.use(Baz) + @klass.send(:include, Baz) assert_equal true, @klass.setup end def test_modules_dependencies_are_met - @klass.use(Bar) + @klass.send(:include, Bar) assert_equal "bar", @klass.new.bar assert_equal "bar+baz", @klass.new.baz assert_equal "baz", @klass.baz - assert_equal [SetupTest::Bar, SetupTest::Baz], @klass.included_modules[0..1] + assert_equal [DependencyModuleTest::Bar, DependencyModuleTest::Baz], @klass.included_modules[0..1] end end |