spec/selector_spec.rb in hx-0.14.0 vs spec/selector_spec.rb in hx-0.15.0
- old
+ new
@@ -81,5 +81,23 @@
(filter & Hx::Path::ALL).should equal(filter)
(Hx::Path::ALL & filter).should equal(filter)
(Hx::Path::ALL & Hx::Path::ALL).should equal(Hx::Path::ALL)
end
end
+
+describe "Hx::Path::Selector" do
+ it "should be able to elide specific circumfixes" do
+ filter = Hx::Path.parse_pattern("foo").elide_circumfix("XXX", "YYY")
+ filter.should accept_path("XXXfooYYY")
+ filter.should_not accept_path("foo")
+ filter.should_not accept_path("XXXfoo")
+ filter.should_not accept_path("fooYYY")
+ end
+
+ it "should be able to assume specific circumfixes" do
+ filter = Hx::Path.parse_pattern("XXXfooYYY").assume_circumfix("XXX", "YYY")
+ filter.should accept_path("foo")
+ filter.should_not accept_path("XXXfoo")
+ filter.should_not accept_path("fooYYY")
+ filter.should_not accept_path("XXXfooYYY")
+ end
+end