diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 17 | ||||
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 1 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 1 | ||||
-rw-r--r-- | activesupport/test/json/decoding_test.rb | 1 | ||||
-rw-r--r-- | activesupport/test/multibyte_utils_test.rb | 1 | ||||
-rw-r--r-- | activesupport/test/safe_buffer_test.rb | 6 | ||||
-rw-r--r-- | activesupport/test/test_test.rb | 1 |
7 files changed, 16 insertions, 12 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 5e6a2102e0..6bb13ec9b8 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -212,7 +212,7 @@ module CacheStoreBehavior @cache.write('foo', 'bar', :compress => true) raw_value = @cache.send(:read_entry, 'foo', {}).raw_value assert_equal 'bar', @cache.read('foo') - assert_equal 'bar', raw_value + assert_equal 'bar', Marshal.load(raw_value) end def test_read_and_write_compressed_large_data @@ -278,10 +278,12 @@ module CacheStoreBehavior assert !@cache.exist?('foo') end - def test_store_objects_should_be_immutable + def test_read_should_return_a_different_object_id_each_time_it_is_called @cache.write('foo', 'bar') - assert_raise(ActiveSupport::FrozenObjectError) { @cache.read('foo').gsub!(/.*/, 'baz') } - assert_equal 'bar', @cache.read('foo') + assert_not_equal @cache.read('foo').object_id, @cache.read('foo').object_id + value = @cache.read('foo') + value << 'bingo' + assert_not_equal value, @cache.read('foo') end def test_original_store_objects_should_not_be_immutable @@ -559,7 +561,8 @@ end class MemoryStoreTest < ActiveSupport::TestCase def setup - @cache = ActiveSupport::Cache.lookup_store(:memory_store, :expires_in => 60, :size => 100) + @record_size = Marshal.dump("aaaaaaaaaa").bytesize + @cache = ActiveSupport::Cache.lookup_store(:memory_store, :expires_in => 60, :size => @record_size * 10) end include CacheStoreBehavior @@ -574,7 +577,7 @@ class MemoryStoreTest < ActiveSupport::TestCase @cache.write(5, "eeeeeeeeee") && sleep(0.001) @cache.read(2) && sleep(0.001) @cache.read(4) - @cache.prune(30) + @cache.prune(@record_size * 3) assert_equal true, @cache.exist?(5) assert_equal true, @cache.exist?(4) assert_equal false, @cache.exist?(3) @@ -727,7 +730,7 @@ class CacheEntryTest < ActiveSupport::TestCase def test_non_compress_values entry = ActiveSupport::Cache::Entry.new("value") assert_equal "value", entry.value - assert_equal "value", entry.raw_value + assert_equal "value", Marshal.load(entry.raw_value) assert_equal false, entry.compressed? end end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 18a86e08f5..a4bba056df 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -6,7 +6,6 @@ require 'inflector_test_cases' require 'active_support/inflector' require 'active_support/core_ext/string' require 'active_support/time' -require 'active_support/core_ext/kernel/reporting' require 'active_support/core_ext/string/strip' class StringInflectionsTest < Test::Unit::TestCase diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index b4edf0f51d..b0e96731cc 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -1,7 +1,6 @@ require 'abstract_unit' require 'pp' require 'active_support/dependencies' -require 'active_support/core_ext/kernel/reporting' module ModuleWithMissing mattr_accessor :missing_count diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb index 201729a6c2..d1454902e5 100644 --- a/activesupport/test/json/decoding_test.rb +++ b/activesupport/test/json/decoding_test.rb @@ -2,7 +2,6 @@ require 'abstract_unit' require 'active_support/json' require 'active_support/time' -require 'active_support/core_ext/kernel/reporting' class TestJSONDecoding < ActiveSupport::TestCase TESTS = { diff --git a/activesupport/test/multibyte_utils_test.rb b/activesupport/test/multibyte_utils_test.rb index 1dff944922..0a2f20d282 100644 --- a/activesupport/test/multibyte_utils_test.rb +++ b/activesupport/test/multibyte_utils_test.rb @@ -2,7 +2,6 @@ require 'abstract_unit' require 'multibyte_test_helpers' -require 'active_support/core_ext/kernel/reporting' class MultibyteUtilsTest < ActiveSupport::TestCase include MultibyteTestHelpers diff --git a/activesupport/test/safe_buffer_test.rb b/activesupport/test/safe_buffer_test.rb index 7662e9b765..8f77999d25 100644 --- a/activesupport/test/safe_buffer_test.rb +++ b/activesupport/test/safe_buffer_test.rb @@ -106,4 +106,10 @@ class SafeBufferTest < ActiveSupport::TestCase test "should not fail if the returned object is not a string" do assert_kind_of NilClass, @buffer.slice("chipchop") end + + test "Should initialize @dirty to false for new instance when sliced" do + dirty = @buffer[0,0].send(:dirty?) + assert_not_nil dirty + assert !dirty + end end diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 5bd995aa32..f880052786 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -1,5 +1,4 @@ require 'abstract_unit' -require 'active_support/core_ext/kernel/reporting' class AssertDifferenceTest < ActiveSupport::TestCase def setup |