diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-05-28 11:35:36 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-05-28 11:35:36 -0500 |
commit | 4e50a35fa243f6cf7ad567774a9f7c1cb87a1653 (patch) | |
tree | 6bfb95c899c61b10406a03f8e9a6211b93fecd6b /activesupport/test | |
parent | de203245afd2bbf7f93f3241fcf3a71a88101d47 (diff) | |
download | rails-4e50a35fa243f6cf7ad567774a9f7c1cb87a1653.tar.gz rails-4e50a35fa243f6cf7ad567774a9f7c1cb87a1653.tar.bz2 rails-4e50a35fa243f6cf7ad567774a9f7c1cb87a1653.zip |
Break up DependencyModule's dual function of providing a "depend_on" DSL and "included" block DSL into separate modules. But, unify both approaches under AS::Concern.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/concern_test.rb (renamed from activesupport/test/dependency_module_test.rb) | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/activesupport/test/dependency_module_test.rb b/activesupport/test/concern_test.rb index be7db0fa7b..22f7ec2064 100644 --- a/activesupport/test/dependency_module_test.rb +++ b/activesupport/test/concern_test.rb @@ -1,9 +1,9 @@ require 'abstract_unit' -require 'active_support/dependency_module' +require 'active_support/concern' -class DependencyModuleTest < Test::Unit::TestCase +class ConcernTest < Test::Unit::TestCase module Baz - extend ActiveSupport::DependencyModule + extend ActiveSupport::Concern module ClassMethods def baz @@ -29,7 +29,7 @@ class DependencyModuleTest < Test::Unit::TestCase end module Bar - extend ActiveSupport::DependencyModule + extend ActiveSupport::Concern depends_on Baz @@ -43,7 +43,7 @@ class DependencyModuleTest < Test::Unit::TestCase end module Foo - extend ActiveSupport::DependencyModule + extend ActiveSupport::Concern depends_on Bar, Baz end @@ -55,17 +55,17 @@ class DependencyModuleTest < Test::Unit::TestCase def test_module_is_included_normally @klass.send(:include, Baz) assert_equal "baz", @klass.new.baz - assert_equal DependencyModuleTest::Baz, @klass.included_modules[0] + assert_equal ConcernTest::Baz, @klass.included_modules[0] @klass.send(:include, Baz) assert_equal "baz", @klass.new.baz - assert_equal DependencyModuleTest::Baz, @klass.included_modules[0] + assert_equal ConcernTest::Baz, @klass.included_modules[0] end def test_class_methods_are_extended @klass.send(:include, Baz) assert_equal "baz", @klass.baz - assert_equal DependencyModuleTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0] + assert_equal ConcernTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0] end def test_included_block_is_ran @@ -78,11 +78,11 @@ class DependencyModuleTest < Test::Unit::TestCase assert_equal "bar", @klass.new.bar assert_equal "bar+baz", @klass.new.baz assert_equal "baz", @klass.baz - assert_equal [DependencyModuleTest::Bar, DependencyModuleTest::Baz], @klass.included_modules[0..1] + assert_equal [ConcernTest::Bar, ConcernTest::Baz], @klass.included_modules[0..1] end def test_depends_on_with_multiple_modules @klass.send(:include, Foo) - assert_equal [DependencyModuleTest::Foo, DependencyModuleTest::Bar, DependencyModuleTest::Baz], @klass.included_modules[0..2] + assert_equal [ConcernTest::Foo, ConcernTest::Bar, ConcernTest::Baz], @klass.included_modules[0..2] end end |