From 2d5ec5d4851bd44a7f10403fee204ffbe20e36cd Mon Sep 17 00:00:00 2001 From: Ryan Lue Date: Tue, 15 Jan 2019 17:12:44 +0800 Subject: [PATCH] Add test case for removed edge case handling in Cache.clear --- spec/lib/cache_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/lib/cache_spec.rb b/spec/lib/cache_spec.rb index 07041c913..3db7df3f9 100644 --- a/spec/lib/cache_spec.rb +++ b/spec/lib/cache_spec.rb @@ -86,7 +86,15 @@ RSpec.describe Cache do Cache.write('123', 'some value') Cache.clear - expect { Cache.delete('123') }.not_to raise_error + expect { Cache.clear }.not_to raise_error + end + + context 'when cache directory is not present on disk' do + before { FileUtils.rm_rf(Rails.cache.cache_path) } + + it 'does not raise an error' do + expect { Cache.clear }.not_to raise_error + end end end end