aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-06-02 12:36:36 -0300
committerEmilio Tagua <miloops@gmail.com>2009-06-02 12:36:36 -0300
commitfd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90 (patch)
tree89f6b8eeae81ba9e9f3c43667b234b64a776e649 /activesupport/test
parent5255a81b808c2c947d58df979e6436b1fe1d8157 (diff)
parent196f780e30fcece25e4d09c12f9b9f7374ebed29 (diff)
downloadrails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.tar.gz
rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.tar.bz2
rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record.rb
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/caching_test.rb9
-rw-r--r--activesupport/test/concern_test.rb (renamed from activesupport/test/dependency_module_test.rb)35
2 files changed, 31 insertions, 13 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index bd237a5c8e..51d04d9388 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -180,6 +180,15 @@ uses_memcached 'memcached backed store' do
end
end
+ def test_stored_objects_should_not_be_frozen
+ @cache.with_local_cache do
+ @cache.write('foo', 'bar')
+ end
+ @cache.with_local_cache do
+ assert !@cache.read('foo').frozen?
+ end
+ end
+
def test_write_should_return_true_on_success
@cache.with_local_cache do
result = @cache.write('foo', 'bar')
diff --git a/activesupport/test/dependency_module_test.rb b/activesupport/test/concern_test.rb
index be7db0fa7b..4cbe56a2d2 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
@@ -19,6 +19,9 @@ class DependencyModuleTest < Test::Unit::TestCase
end
end
+ module InstanceMethods
+ end
+
included do
self.included_ran = true
end
@@ -29,9 +32,9 @@ class DependencyModuleTest < Test::Unit::TestCase
end
module Bar
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
- depends_on Baz
+ include Baz
def bar
"bar"
@@ -43,9 +46,9 @@ class DependencyModuleTest < Test::Unit::TestCase
end
module Foo
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
- depends_on Bar, Baz
+ include Bar, Baz
end
def setup
@@ -55,17 +58,23 @@ 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 @klass.included_modules.include?(ConcernTest::Baz)
@klass.send(:include, Baz)
assert_equal "baz", @klass.new.baz
- assert_equal DependencyModuleTest::Baz, @klass.included_modules[0]
+ assert @klass.included_modules.include?(ConcernTest::Baz)
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_instance_methods_are_included
+ @klass.send(:include, Baz)
+ assert_equal "baz", @klass.new.baz
+ assert @klass.included_modules.include?(ConcernTest::Baz::InstanceMethods)
end
def test_included_block_is_ran
@@ -78,11 +87,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 @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 [DependencyModuleTest::Foo, DependencyModuleTest::Bar, DependencyModuleTest::Baz], @klass.included_modules[0..2]
+ assert_equal [ConcernTest::Foo, ConcernTest::Bar, ConcernTest::Baz::InstanceMethods, ConcernTest::Baz], @klass.included_modules[0..3]
end
end