Topic: :file_store cache not deleting file

Wanted to mess around with the cache in Rails 2.1 this morning ... setup the :file_store to point to tmp/cache, wrote a little test, everything passed. Wonderful. But if I look in the cache dir the file is still there. I looked at the source and everything seems fine ... so I pulled out the read, write, and delete lines that Rails calls and put them in their own test. They work perfectly! So why the heck would I see different behavior when using the cache itself?? Here's an example:

    setup do
      @c = Rails.cache
    end
   
    should "write and read" do
      @c.write('key', 'value')
      assert_equal 'value', @c.read('key')
    end
   
    should "remove object on delete" do
      assert @c.delete('key')
      assert_nil @c.read('key')
    end
   
    should "be able to delete files in tests" do
      File.open('tmp/cache/test.cache', "wb+") { |f| f.write('foo') }
      v = File.open('tmp/cache/test.cache', 'rb') { |f| f.read }
      assert_equal v, 'foo'
      File.delete('tmp/cache/test.cache')
    end

Everything passes. End result is tmp/cache contains a key.cache but not a test.cache file. I'm befuddled.

Re: :file_store cache not deleting file

doh! That should have been obvious ... forgot that the code isn't necessarily executed in order.  The "remove" test was being called before the "write and read"  test.