Formatting changes to the DN class.

This commit is contained in:
Austin Ziegler 2011-03-17 22:25:22 -04:00
parent f50ba57e99
commit 393b57405d
2 changed files with 129 additions and 115 deletions

View file

@ -4,16 +4,20 @@ require 'net/ldap/dn'
describe Net::LDAP::DN do
describe "<- .construct" do
attr_reader :dn
before(:each) do
@dn = Net::LDAP::DN.new('cn', ',+"\\<>;', 'ou=company')
end
it "should construct a Net::LDAP::DN" do
dn.should be_an_instance_of(Net::LDAP::DN)
end
it "should escape all the required characters" do
dn.to_s.should == 'cn=\\,\\+\\"\\\\\\<\\>\\;,ou=company'
end
end
describe "<- .to_a" do
context "parsing" do
{
@ -23,12 +27,15 @@ describe Net::LDAP::DN do
}.each do |key, value|
context "(#{key})" do
attr_reader :dn
before(:each) do
@dn = Net::LDAP::DN.new(key)
end
it "should decode into a Net::LDAP::DN" do
dn.should be_an_instance_of(Net::LDAP::DN)
end
it "should return the correct array" do
dn.to_a.should == value
end
@ -48,12 +55,15 @@ describe Net::LDAP::DN do
].each do |value|
context "(#{value})" do
attr_reader :dn
before(:each) do
@dn = Net::LDAP::DN.new(value)
end
it "should decode into a Net::LDAP::DN" do
dn.should be_an_instance_of(Net::LDAP::DN)
end
it "should raise an error on parsing" do
lambda { dn.to_a }.should raise_error
end