+ Spec for Net::LDAP::Entry
Pretty much rewrote the code. It now also responds to respond_to? correctly. Most of that symbol manipulation is now in just one place.
This commit is contained in:
parent
c01dc9ee89
commit
cfd9dbc922
2 changed files with 115 additions and 56 deletions
51
spec/unit/ldap/entry_spec.rb
Normal file
51
spec/unit/ldap/entry_spec.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Net::LDAP::Entry do
|
||||
attr_reader :entry
|
||||
before(:each) do
|
||||
@entry = Net::LDAP::Entry.from_single_ldif_string(
|
||||
%Q{dn: something
|
||||
foo: foo
|
||||
barAttribute: bar
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
describe "entry access" do
|
||||
it "should always respond to #dn" do
|
||||
entry.should respond_to(:dn)
|
||||
end
|
||||
|
||||
context "<- #foo" do
|
||||
it "should respond_to?" do
|
||||
entry.should respond_to(:foo)
|
||||
end
|
||||
it "should return 'foo'" do
|
||||
entry.foo.should == ['foo']
|
||||
end
|
||||
end
|
||||
context "<- #Foo" do
|
||||
it "should respond_to?" do
|
||||
entry.should respond_to(:Foo)
|
||||
end
|
||||
it "should return 'foo'" do
|
||||
entry.foo.should == ['foo']
|
||||
end
|
||||
end
|
||||
context "<- #foo=" do
|
||||
it "should respond_to?" do
|
||||
entry.should respond_to(:foo=)
|
||||
end
|
||||
it "should set 'foo'" do
|
||||
entry.foo= 'bar'
|
||||
entry.foo.should == ['bar']
|
||||
end
|
||||
end
|
||||
context "<- #fOo=" do
|
||||
it "should return 'foo'" do
|
||||
entry.fOo= 'bar'
|
||||
entry.fOo.should == ['bar']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue