From b7c96eb3ee24cffd3cf7558a112aea07240299fa Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Sun, 9 Apr 2017 03:10:06 +0200 Subject: [PATCH] fix spec for caching already optimised images --- spec/image_optim/cache_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/image_optim/cache_spec.rb b/spec/image_optim/cache_spec.rb index 4ef9c534..07b5ab4f 100644 --- a/spec/image_optim/cache_spec.rb +++ b/spec/image_optim/cache_spec.rb @@ -69,7 +69,7 @@ cached_s = cached.to_s expect(FileTest).to receive(:file?).with(cached_s).and_return(false) expect(FileTest).not_to receive(:size?).with(cached_s) - expect(FileUtils).to receive(:mv).with(anything, tmp_file) + expect(FileUtils).to receive(:mv).with(optimized, tmp_file) expect(tmp_file).to receive(:rename).with(cached) expect(cache.fetch(original){ optimized }).to eq(cached) @@ -79,10 +79,10 @@ cached_s = cached.to_s expect(FileTest).to receive(:file?).with(cached_s).and_return(false) expect(FileTest).not_to receive(:size?).with(cached_s) - expect(FileUtils).to receive(:mv).with(anything, tmp_file) - expect(tmp_file).to receive(:rename).with(cached) + expect(FileUtils).not_to receive(:mv) + expect(FileUtils).to receive(:touch).with(cached) - expect(cache.fetch(original){ optimized }).to eq(cached) + expect(cache.fetch(original){ nil }).to eq(nil) end end end @@ -106,7 +106,7 @@ expect(FileUtils).not_to receive(:mv) expect(File).not_to receive(:rename) - expect(cache.fetch(original){}).to eq(nil) + expect(cache.fetch(original){ nil }).to eq(nil) end end end