Skip to content

Commit

Permalink
fix spec for caching already optimised images
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Apr 9, 2017
1 parent 7f77946 commit b7c96eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/image_optim/cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b7c96eb

Please sign in to comment.