spec/selector_spec.rb in hx-0.8.4 vs spec/selector_spec.rb in hx-0.9.0

- old
+ new

@@ -7,26 +7,26 @@ Hx::Path::Pattern.should < Hx::Path::Selector end it "should accept or reject literal paths" do pattern = Hx::Path.literal("foo/bar") - pattern.should accept("foo/bar") - pattern.should_not accept("foo/baz") + pattern.should accept_path("foo/bar") + pattern.should_not accept_path("foo/baz") end it "should match single path components with stars" do pattern = Hx::Path.parse_pattern("foo/*") - pattern.should_not accept("baz/eek") - pattern.should accept("foo/bar") - pattern.should_not accept("foo/bar/baz") + pattern.should_not accept_path("baz/eek") + pattern.should accept_path("foo/bar") + pattern.should_not accept_path("foo/bar/baz") end it "should match multiple path components with double stars" do pattern = Hx::Path.parse_pattern("foo/**") - pattern.should_not accept("baz/eek") - pattern.should accept("foo/bar") - pattern.should accept("foo/bar/baz") + pattern.should_not accept_path("baz/eek") + pattern.should accept_path("foo/bar") + pattern.should accept_path("foo/bar/baz") end end describe "Hx::Path::Selector disjunctions" do it "should be possible" do @@ -36,13 +36,13 @@ end it "should accept and reject the right paths" do filters = ["foo/bar", "abcdefg"].map { |p| Hx::Path.parse_pattern(p) } filter = filters.inject { |a, b| a | b } - filter.should accept("foo/bar") - filter.should accept("abcdefg") - filter.should_not accept("hoge") + filter.should accept_path("foo/bar") + filter.should accept_path("abcdefg") + filter.should_not accept_path("hoge") end end describe "negated Hx::Path::Selectors" do before :each do @@ -52,12 +52,12 @@ it "should be possible" do @pattern.should be_a_kind_of(Hx::Path::Selector) end it "should reject what they match" do - @pattern.should_not accept("foobar") - @pattern.should accept("hoge") + @pattern.should_not accept_path("foobar") + @pattern.should accept_path("hoge") end end describe "Hx::Path::Selector conjunctions" do it "should be possible" do @@ -67,14 +67,14 @@ end it "should accept only paths matching both filters" do filters = ["foo*", "*bar"].map { |p| Hx::Path.parse_pattern(p) } filter = filters.inject { |a, b| a & b } - filter.should accept("foobar") - filter.should accept("fooxbar") - filter.should_not accept("lemur") - filter.should_not accept("foobear") - filter.should_not accept("rebar") + filter.should accept_path("foobar") + filter.should accept_path("fooxbar") + filter.should_not accept_path("lemur") + filter.should_not accept_path("foobear") + filter.should_not accept_path("rebar") end it "should optimize use of ALL" do filter = Hx::Path.parse_pattern("foo") (filter & Hx::Path::ALL).should equal(filter)