mock(FileUtils).rm does not remove the file
krissi opened this issue · comments
Christian Haase commented
The mocks in (at least) it "cleans up if exporting into an existing dir"
in systemd_spec.rb
causing the files not to be deleted. It seems RR does not support a pendant of rspecs and_call_original
.
This seemed to work in previous cases, but it took me a while to identify. In two cases this made problems:
- https://github.com/krissi/foreman/blob/instantiate-systemd-services/lib/foreman/export/systemd.rb#L31
- https://github.com/krissi/foreman/blob/instantiate-systemd-services/lib/foreman/export/base.rb#L106 I would have been used
FileUtils.rmdir
instead of#rm_r
to not delete foreign files by accident.
I think this does not need to be solved immediately and can wait until e.g. rspec is upgraded to 3 something.
David Dollar commented
I have no plans to upgrade the testing infrastructure in foreman so I'd happily accept a PR to fix this.