Skip to content

Commit 4186ffc

Browse files
committed
fix cache spec by stubbing mkdir (Pathname#mkpath is not using FileUtils anymore)
1 parent 60a7d5b commit 4186ffc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

spec/image_optim/cache_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
let(:cache_dir) do
1717
dir = '/somewhere/cache'
18-
allow(FileUtils).to receive(:mkpath).with(Regexp.new(Regexp.escape(dir)), any_args)
18+
allow(Dir).to receive(:mkdir).with(File.dirname(dir))
19+
allow(Dir).to receive(:mkdir).with(dir)
20+
allow(Dir).to receive(:mkdir).with(%r{\A#{Regexp.escape(dir)}/[^/]+\z})
1921
allow(FileUtils).to receive(:touch)
2022
allow(FSPath).to receive(:temp_file_path) do
2123
tmp_file

0 commit comments

Comments
 (0)