From 472b8e054b293c3c4a07572bd2d4904d51d861e0 Mon Sep 17 00:00:00 2001
From: Xavier Noria <fxn@hashref.com>
Date: Wed, 11 Nov 2015 10:18:43 +0100
Subject: revises the implementation of Pathname#ascendant_of? (in refinement)

---
 .../test/file_evented_update_checker_test.rb       | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

(limited to 'activesupport/test')

diff --git a/activesupport/test/file_evented_update_checker_test.rb b/activesupport/test/file_evented_update_checker_test.rb
index 9d09cbca8f..071449d399 100644
--- a/activesupport/test/file_evented_update_checker_test.rb
+++ b/activesupport/test/file_evented_update_checker_test.rb
@@ -118,4 +118,33 @@ class FileEventedUpdateCheckerPathHelperTest < ActiveSupport::TestCase
 
     assert_equal paths.values_at(0, 2, 4), @ph.filter_out_descendants(paths)
   end
+
+  test '#filter_out_descendants works on path units' do
+    paths = %w(
+      /foo/bar
+      /foo/barrrr
+    ).map { |path| pn(path) }
+
+    assert_equal paths, @ph.filter_out_descendants(paths)
+  end
+
+  test '#filter_out_descendants deals correctly with the root directory' do
+    paths = %w(
+      /
+      /foo
+      /foo/bar
+    ).map { |path| pn(path) }
+
+    assert_equal paths.values_at(0), @ph.filter_out_descendants(paths)
+  end
+
+  test '#filter_out_descendants preserves duplicates' do
+    paths = %w(
+      /foo
+      /foo/bar
+      /foo
+    ).map { |path| pn(path) }
+
+    assert_equal paths.values_at(0, 2), @ph.filter_out_descendants(paths)
+  end
 end
-- 
cgit v1.2.3