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