Permalink
Browse files

Improved testing so that it tests the real functionality and not the …

…private method.

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 5986d9b commit ef9cf3d46a718a6573b93b085fb899193eeeda04 @phuibonhoa phuibonhoa committed with josevalim Oct 2, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 activesupport/test/caching_test.rb
View
9 activesupport/test/caching_test.rb
@@ -580,11 +580,12 @@ def test_key_transformation_max_filename_size
assert_equal 'B', File.basename(path)
end
- def test_search_dir_when_directory_does_not_exist
- ActiveSupport::Cache::FileStore.new('test').send(:search_dir, 'dir_does_not_exist') do |path|
- flunk "search_dir yielded but should have done nothing"
+ # If nothing has been stored in the cache, there is a chance the cache directory does not yet exist
+ # Ensure delete_matched gracefully handles this case
+ def test_delete_matched_when_cache_directory_does_not_exist
+ assert_nothing_raised(Exception) do
+ ActiveSupport::Cache::FileStore.new('/test/cache/directory').delete_matched(/does_not_exist/)
end
- assert true
end
end

0 comments on commit ef9cf3d

Please sign in to comment.