aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/caching_test.rb6
-rw-r--r--activesupport/test/core_ext/duration_test.rb2
-rw-r--r--activesupport/test/core_ext/numeric_ext_test.rb2
-rw-r--r--activesupport/test/core_ext/object_and_class_ext_test.rb2
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb2
-rw-r--r--activesupport/test/dependency_module_test.rb11
-rw-r--r--activesupport/test/i18n_test.rb2
-rw-r--r--activesupport/test/new_callbacks_test.rb62
-rw-r--r--activesupport/test/time_zone_test.rb2
9 files changed, 85 insertions, 6 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index ad19dcfd09..bd237a5c8e 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -27,6 +27,12 @@ class CacheStoreSettingTest < ActiveSupport::TestCase
assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
end
+ def test_mem_cache_fragment_cache_store_with_given_mem_cache_like_object
+ MemCache.expects(:new).never
+ store = ActiveSupport::Cache.lookup_store :mem_cache_store, stub("memcache", :get => true)
+ assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
+ end
+
def test_mem_cache_fragment_cache_store_with_multiple_servers
MemCache.expects(:new).with(%w[localhost 192.168.1.1], {})
store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1'
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index 30d4152729..6f16621ae5 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'active_support/core/time'
+require 'active_support/time'
class DurationTest < ActiveSupport::TestCase
def test_inspect
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb
index 74b086fa9c..992ec60302 100644
--- a/activesupport/test/core_ext/numeric_ext_test.rb
+++ b/activesupport/test/core_ext/numeric_ext_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
+require 'active_support/time'
require 'active_support/core_ext/numeric'
require 'active_support/core_ext/integer'
-require 'active_support/core/time'
class NumericExtTimeAndDateTimeTest < Test::Unit::TestCase
def setup
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb
index 8869b053e6..f0121b862d 100644
--- a/activesupport/test/core_ext/object_and_class_ext_test.rb
+++ b/activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
+require 'active_support/time'
require 'active_support/core_ext/object'
require 'active_support/core_ext/class/removal'
-require 'active_support/core/time'
class ClassA; end
class ClassB < ClassA; end
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index e265423f06..1c2d0fbce4 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'active_support/core/time'
+require 'active_support/time'
class TimeExtCalculationsTest < Test::Unit::TestCase
def test_seconds_since_midnight
diff --git a/activesupport/test/dependency_module_test.rb b/activesupport/test/dependency_module_test.rb
index 07090d15a1..be7db0fa7b 100644
--- a/activesupport/test/dependency_module_test.rb
+++ b/activesupport/test/dependency_module_test.rb
@@ -42,6 +42,12 @@ class DependencyModuleTest < Test::Unit::TestCase
end
end
+ module Foo
+ extend ActiveSupport::DependencyModule
+
+ depends_on Bar, Baz
+ end
+
def setup
@klass = Class.new
end
@@ -74,4 +80,9 @@ class DependencyModuleTest < Test::Unit::TestCase
assert_equal "baz", @klass.baz
assert_equal [DependencyModuleTest::Bar, DependencyModuleTest::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]
+ end
end
diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb
index 2a08abfb3e..9868f1e87d 100644
--- a/activesupport/test/i18n_test.rb
+++ b/activesupport/test/i18n_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'active_support/core/time'
+require 'active_support/time'
require 'active_support/core_ext/array/conversions'
class I18nTest < Test::Unit::TestCase
diff --git a/activesupport/test/new_callbacks_test.rb b/activesupport/test/new_callbacks_test.rb
index dec6106ac1..7bec47224d 100644
--- a/activesupport/test/new_callbacks_test.rb
+++ b/activesupport/test/new_callbacks_test.rb
@@ -396,6 +396,68 @@ module NewCallbacksTest
end
end
+ class CallbackObject
+ def before_save(caller)
+ caller.record << "before"
+ end
+
+ def around_save(caller)
+ caller.record << "around before"
+ yield
+ caller.record << "around after"
+ end
+ end
+
+ class UsingObjectBefore
+ include ActiveSupport::NewCallbacks
+
+ define_callbacks :save
+ save_callback :before, CallbackObject.new
+
+ attr_accessor :record
+ def initialize
+ @record = []
+ end
+
+ def save
+ _run_save_callbacks do
+ @record << "yielded"
+ end
+ end
+ end
+
+ class UsingObjectAround
+ include ActiveSupport::NewCallbacks
+
+ define_callbacks :save
+ save_callback :around, CallbackObject.new
+
+ attr_accessor :record
+ def initialize
+ @record = []
+ end
+
+ def save
+ _run_save_callbacks do
+ @record << "yielded"
+ end
+ end
+ end
+
+ class UsingObjectTest < Test::Unit::TestCase
+ def test_before_object
+ u = UsingObjectBefore.new
+ u.save
+ assert_equal ["before", "yielded"], u.record
+ end
+
+ def test_around_object
+ u = UsingObjectAround.new
+ u.save
+ assert_equal ["around before", "yielded", "around after"], u.record
+ end
+ end
+
class CallbackTerminatorTest < Test::Unit::TestCase
def test_termination
terminator = CallbackTerminator.new
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 87d6ccc30d..99c4310854 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'active_support/core/time'
+require 'active_support/time'
class TimeZoneTest < Test::Unit::TestCase
def test_utc_to_local