Skip to content

Commit b6c6dda

Browse files
author
Tatsuya Sato
committed
Fix Invalid examples
1. String#encode should not fail if given an invalid code like '\x81' This is because this problem has been resolved by ruby-ldap#41. 2. Net::LDAP#search should return a boolean if return_result is false.
1 parent 8a18267 commit b6c6dda

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spec/unit/ber/ber_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
["6a31b4a12aa27a41aca9603f27dd5116"].pack("H*").to_ber_bin.should ==
9090
"\x04\x10" + "j1\xB4\xA1*\xA2zA\xAC\xA9`?'\xDDQ\x16"
9191
end
92-
it "should fail on strings that can not be converted to UTF-8" do
92+
it "should not fail on strings that can not be converted to UTF-8" do
9393
error = Encoding::UndefinedConversionError
94-
lambda {"\x81".to_ber }.should raise_exception(error)
94+
lambda {"\x81".to_ber }.should_not raise_exception(error)
9595
end
9696
end
9797
end

spec/unit/ldap/search_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Net::LDAP, "search method" do
44
class FakeConnection
55
def search(args)
6-
OpenStruct.new(:result_code => 1, :message => "error")
6+
OpenStruct.new(:result_code => 1, :message => "error", :success? => false)
77
end
88
end
99

@@ -22,7 +22,7 @@ def search(args)
2222
context "when :return_result => false" do
2323
it "should return false upon error" do
2424
result = @connection.search(:return_result => false)
25-
result.result_code.should == 1
25+
result.should be_false
2626
end
2727
end
2828

0 commit comments

Comments
 (0)