|
127 | 127 | :instrumentation_service => @service) |
128 | 128 | end |
129 | 129 |
|
130 | | - it "should publish a socket write event, followed by a socket read event" do |
| 130 | + it "should publish a write.net_ldap_connection event" do |
131 | 131 | ber = Net::BER::BerIdentifiedArray.new([0, "", ""]) |
132 | 132 | ber.ber_identifier = 7 |
133 | | - read_result = [2, ber] |
134 | | - @tcp_socket.should_receive(:read_ber).and_return(read_result) |
| 133 | + @tcp_socket.should_receive(:read_ber).and_return([2, ber]) |
135 | 134 |
|
136 | | - write_events = @service.subscribe "write.net_ldap_connection" |
137 | | - read_events = @service.subscribe "read.net_ldap_connection" |
| 135 | + events = @service.subscribe "write.net_ldap_connection" |
138 | 136 |
|
139 | | - result = subject.modify(:dn => "1", :operations => [[:replace, "mail", "something@sothsdkf.com"]]) |
| 137 | + result = subject.bind(method: :anon) |
140 | 138 | result.should be_success |
141 | 139 |
|
142 | 140 | # a write event |
143 | | - payload, result = write_events.pop |
| 141 | + payload, result = events.pop |
144 | 142 | payload.should have_key(:result) |
145 | 143 | payload.should have_key(:packet) |
| 144 | + end |
| 145 | + |
| 146 | + it "should publish a read.net_ldap_connection event" do |
| 147 | + ber = Net::BER::BerIdentifiedArray.new([0, "", ""]) |
| 148 | + ber.ber_identifier = 7 |
| 149 | + read_result = [2, ber] |
| 150 | + @tcp_socket.should_receive(:read_ber).and_return(read_result) |
| 151 | + |
| 152 | + events = @service.subscribe "read.net_ldap_connection" |
| 153 | + |
| 154 | + result = subject.bind(method: :anon) |
| 155 | + result.should be_success |
146 | 156 |
|
147 | | - # then a read event |
148 | | - payload, result = read_events.pop |
| 157 | + # a read event |
| 158 | + payload, result = events.pop |
149 | 159 | payload.should have_key(:result) |
150 | 160 | result.should == read_result |
151 | 161 | end |
|
0 commit comments