From beb9f924090cdec08db2f640cd906b6ea3bec228 Mon Sep 17 00:00:00 2001 From: Michael Kessler Date: Thu, 12 May 2011 18:16:32 +0200 Subject: [PATCH] Don't rely on the (almost random) order of an Array. --- spec/guard/listener_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/guard/listener_spec.rb b/spec/guard/listener_spec.rb index 8999fbe..3cc7583 100644 --- a/spec/guard/listener_spec.rb +++ b/spec/guard/listener_spec.rb @@ -54,21 +54,21 @@ describe Guard::Listener do context "without the :all option" do it "finds modified files only in the directory supplied" do FileUtils.touch([file1, file2, file3]) - subject.modified_files([@fixture_path.join("folder1/")], {}).should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] + subject.modified_files([@fixture_path.join("folder1/")], {}).sort.should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] end end context "with the :all options" do it "finds modified files within subdirectories" do FileUtils.touch([file1, file2, file3]) - subject.modified_files([@fixture_path.join("folder1/")], { :all => true }).should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt", "spec/fixtures/folder1/folder2/file2.txt"] + subject.modified_files([@fixture_path.join("folder1/")], { :all => true }).sort.should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt", "spec/fixtures/folder1/folder2/file2.txt"] end end context "without updating the content" do it "ignores the files for the second time" do FileUtils.touch([file1, file2, file3]) - subject.modified_files([@fixture_path.join("folder1/")], {}).should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] + subject.modified_files([@fixture_path.join("folder1/")], {}).sort.should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] sleep 0.6 FileUtils.touch([file1, file2, file3]) subject.modified_files([@fixture_path.join("folder1/")], {}).should eql [] @@ -76,15 +76,15 @@ describe Guard::Listener do end context "with content that has changed" do - after { File.open(file1, "w") { |f| f.write('') } } + after { File.open(file1, "w") { |f| f.write("") } } it "identifies the files for the second time" do FileUtils.touch([file1, file2, file3]) - subject.modified_files([@fixture_path.join("folder1/")], {}).should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] + subject.modified_files([@fixture_path.join("folder1/")], {}).sort.should eql ["spec/fixtures/folder1/deletedfile1.txt", "spec/fixtures/folder1/file1.txt"] sleep 0.6 FileUtils.touch([file2, file3]) - File.open(file1, "w") { |f| f.write('changed content') } - subject.modified_files([@fixture_path.join("folder1/")], {}).should eql ["spec/fixtures/folder1/file1.txt"] + File.open(file1, "w") { |f| f.write("changed content") } + subject.modified_files([@fixture_path.join("folder1/")], {}).sort.should eql ["spec/fixtures/folder1/file1.txt"] end end end