fixed specs to cleanup afterwards

This commit is contained in:
Darren Pearce 2011-09-13 22:46:56 -06:00
parent b74d09b9d6
commit 34aaed9741

View File

@ -83,7 +83,7 @@ describe Guard::Listener do
let(:file2) { @fixture_path.join("folder1", "folder2", "file2.txt") } let(:file2) { @fixture_path.join("folder1", "folder2", "file2.txt") }
let(:file3) { @fixture_path.join("folder1", "deletedfile1.txt") } let(:file3) { @fixture_path.join("folder1", "deletedfile1.txt") }
let(:file4) { @fixture_path.join("folder1", "movedfile1.txt") } let(:file4) { @fixture_path.join("folder1", "movedfile1.txt") }
let(:destfile) { @fixture_path.join("folder1", "folder2","movedfile1.txt") } let(:file5) { @fixture_path.join("folder1", "folder2", "movedfile1.txt") }
before do before do
@listener = subject @listener = subject
@ -162,8 +162,7 @@ describe Guard::Listener do
end end
after :each do after :each do
FileUtils.touch([file1, file2, file3, file4]) FileUtils.touch([file1, file2, file3])
FileUtils.rm_f([destfile])
end end
it "should be true when set" do it "should be true when set" do
@ -187,9 +186,10 @@ describe Guard::Listener do
["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"]
subject.update_last_event subject.update_last_event
FileUtils.move(file4, destfile) FileUtils.move(file1, file4)
subject.modified_files([@fixture_path.join("folder1")], {}).should =~ subject.modified_files([@fixture_path.join("folder1")], {}).should =~
["!spec/fixtures/folder1/movedfile1.txt"] ["!spec/fixtures/folder1/file1.txt", "spec/fixtures/folder1/movedfile1.txt"]
FileUtils.move(file4, file1)
end end
it "should track deleted files with all option" do it "should track deleted files with all option" do
@ -209,9 +209,10 @@ describe Guard::Listener do
["spec/fixtures/folder1/file1.txt", "spec/fixtures/folder1/folder2/file2.txt"] ["spec/fixtures/folder1/file1.txt", "spec/fixtures/folder1/folder2/file2.txt"]
subject.update_last_event subject.update_last_event
FileUtils.move(file4, destfile) FileUtils.move(file1, file5)
subject.modified_files([@fixture_path.join("folder1")], {:all=>true}).should =~ subject.modified_files([@fixture_path.join("folder1")], {:all=>true}).should =~
["!spec/fixtures/folder1/movedfile1.txt","spec/fixtures/folder1/folder2/movedfile1.txt"] ["!spec/fixtures/folder1/file1.txt","spec/fixtures/folder1/folder2/movedfile1.txt"]
FileUtils.move(file5, file1)
end end
end end
end end