Skip to content

Commit ab19604

Browse files
author
Jamstah
committed
Add breaking tests.
1 parent 5bc73d3 commit ab19604

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

spec/unit/ldap/filter_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def eq(attribute, value)
7676
end
7777
end
7878
describe "<- .escape(str)" do
79-
it "should escape !, &, *, :, | and ~" do
80-
Net::LDAP::Filter.escape('!&*:|~').should == "\\21\\26\\2A\\3A\\7C\\7E"
79+
it "should escape nul, *, (, ) and \\" do
80+
Net::LDAP::Filter.escape("\0*()\\").should == "\\00\\2A\\28\\29\\5C"
8181
end
8282
end
83-
end
83+
end

test/test_filter.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ def test_to_s
2424
assert_equal("(uid=george *)", Filter.eq("uid", "george *").to_s)
2525
end
2626

27+
def test_convenience_filters
28+
assert_equal("(uid=\\2A)", Filter.equals("uid", "*").to_s)
29+
assert_equal("(uid=\\28*)", Filter.begins("uid", "(").to_s)
30+
assert_equal("(uid=*\\29)", Filter.ends("uid", ")").to_s)
31+
assert_equal("(uid=*\\5C*)", Filter.contains("uid", "\\").to_s)
32+
end
33+
2734
def test_c2
2835
assert_equal("(uid=george *)",
2936
Filter.from_rfc2254("uid=george *").to_rfc2254)

0 commit comments

Comments
 (0)