cleanup_spec: inline path creation.
Let's see if this makes the test more reliable.
This commit is contained in:
parent
3ebc64a71d
commit
3724c739f8
@ -199,11 +199,8 @@ describe Homebrew::Cleanup do
|
|||||||
describe "::cleanup_logs" do
|
describe "::cleanup_logs" do
|
||||||
let(:path) { (HOMEBREW_LOGS/"delete_me") }
|
let(:path) { (HOMEBREW_LOGS/"delete_me") }
|
||||||
|
|
||||||
before do
|
|
||||||
path.mkpath
|
|
||||||
end
|
|
||||||
|
|
||||||
it "cleans all logs if prune is 0" do
|
it "cleans all logs if prune is 0" do
|
||||||
|
path.mkpath
|
||||||
described_class.new(days: 0).cleanup_logs
|
described_class.new(days: 0).cleanup_logs
|
||||||
expect(path).not_to exist
|
expect(path).not_to exist
|
||||||
end
|
end
|
||||||
@ -211,6 +208,7 @@ describe Homebrew::Cleanup do
|
|||||||
it "cleans up logs if older than 30 days" do
|
it "cleans up logs if older than 30 days" do
|
||||||
allow_any_instance_of(Pathname).to receive(:ctime).and_return(31.days.ago)
|
allow_any_instance_of(Pathname).to receive(:ctime).and_return(31.days.ago)
|
||||||
allow_any_instance_of(Pathname).to receive(:mtime).and_return(31.days.ago)
|
allow_any_instance_of(Pathname).to receive(:mtime).and_return(31.days.ago)
|
||||||
|
path.mkpath
|
||||||
subject.cleanup_logs
|
subject.cleanup_logs
|
||||||
expect(path).not_to exist
|
expect(path).not_to exist
|
||||||
end
|
end
|
||||||
@ -218,6 +216,7 @@ describe Homebrew::Cleanup do
|
|||||||
it "does not clean up logs less than 30 days old" do
|
it "does not clean up logs less than 30 days old" do
|
||||||
allow_any_instance_of(Pathname).to receive(:ctime).and_return(15.days.ago)
|
allow_any_instance_of(Pathname).to receive(:ctime).and_return(15.days.ago)
|
||||||
allow_any_instance_of(Pathname).to receive(:mtime).and_return(15.days.ago)
|
allow_any_instance_of(Pathname).to receive(:mtime).and_return(15.days.ago)
|
||||||
|
path.mkpath
|
||||||
subject.cleanup_logs
|
subject.cleanup_logs
|
||||||
expect(path).to exist
|
expect(path).to exist
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user