Skip to content

Commit 7d4ece5

Browse files
committed
fix spec for caching already optimised images
1 parent 341e760 commit 7d4ece5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/image_optim/cache_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
cached_s = cached.to_s
7070
expect(FileTest).to receive(:file?).with(cached_s).and_return(false)
7171
expect(FileTest).not_to receive(:size?).with(cached_s)
72-
expect(FileUtils).to receive(:mv).with(anything, tmp_file)
72+
expect(FileUtils).to receive(:mv).with(optimized, tmp_file)
7373
expect(tmp_file).to receive(:rename).with(cached)
7474

7575
expect(cache.fetch(original){ optimized }).to eq(cached)
@@ -79,10 +79,10 @@
7979
cached_s = cached.to_s
8080
expect(FileTest).to receive(:file?).with(cached_s).and_return(false)
8181
expect(FileTest).not_to receive(:size?).with(cached_s)
82-
expect(FileUtils).to receive(:mv).with(anything, tmp_file)
83-
expect(tmp_file).to receive(:rename).with(cached)
82+
expect(FileUtils).not_to receive(:mv)
83+
expect(FileUtils).to receive(:touch).with(cached)
8484

85-
expect(cache.fetch(original){ optimized }).to eq(cached)
85+
expect(cache.fetch(original){ nil }).to eq(nil)
8686
end
8787
end
8888
end
@@ -106,7 +106,7 @@
106106
expect(FileUtils).not_to receive(:mv)
107107
expect(File).not_to receive(:rename)
108108

109-
expect(cache.fetch(original){}).to eq(nil)
109+
expect(cache.fetch(original){ nil }).to eq(nil)
110110
end
111111
end
112112
end

0 commit comments

Comments
 (0)