Skip to content

Commit 2d406e8

Browse files
author
Jerry Cheung
committed
move spec/ber over to test/
1 parent 5b22480 commit 2d406e8

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

spec/unit/ber/ber_spec.rb renamed to test/ber/ber_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
require 'net/ldap'
55

66
describe "BER encoding of" do
7-
8-
RSpec::Matchers.define :properly_encode_and_decode do
7+
8+
RSpec::Matchers.define :properly_encode_and_decode do
99
match do |given|
1010
given.to_ber.read_ber.should == given
1111
end
1212
end
13-
13+
1414
context "arrays" do
1515
it "should properly encode/decode []" do
1616
[].should properly_encode_and_decode
17-
end
17+
end
1818
it "should properly encode/decode [1,2,3]" do
1919
ary = [1,2,3]
2020
encoded_ary = ary.map { |el| el.to_ber }.to_ber
21-
21+
2222
encoded_ary.read_ber.should == ary
23-
end
23+
end
2424
end
2525
context "booleans" do
2626
it "should encode true" do
@@ -62,17 +62,17 @@
6262
it "should correctly handle powers of two" do
6363
100.times do |p|
6464
n = 2 << p
65-
65+
6666
n.should properly_encode_and_decode
6767
end
68-
end
68+
end
6969
it "should correctly handle powers of ten" do
7070
100.times do |p|
7171
n = 5 * 10**p
72-
72+
7373
n.should properly_encode_and_decode
7474
end
75-
end
75+
end
7676
end
7777
end
7878
if "Ruby 1.9".respond_to?(:encoding)
@@ -86,7 +86,7 @@
8686
end
8787
it "should properly encode binary data strings using to_ber_bin" do
8888
# This is used for searching for GUIDs in Active Directory
89-
["6a31b4a12aa27a41aca9603f27dd5116"].pack("H*").to_ber_bin.should ==
89+
["6a31b4a12aa27a41aca9603f27dd5116"].pack("H*").to_ber_bin.should ==
9090
raw_string("\x04\x10" + "j1\xB4\xA1*\xA2zA\xAC\xA9`?'\xDDQ\x16")
9191
end
9292
it "should not fail on strings that can not be converted to UTF-8" do
@@ -108,7 +108,7 @@
108108
"0$\002\001\001`\037\002\001\003\004\rAdministrator\200\vad_is_bogus".
109109
read_ber(Net::LDAP::AsnSyntax).should ==
110110
[1, [3, "Administrator", "ad_is_bogus"]]
111-
end
111+
end
112112
end
113113
end
114114

File renamed without changes.

spec/unit/ber/core_ext/string_spec.rb renamed to test/ber/core_ext/string_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
@str = raw_string("0$\002\001\001`\037\002\001\003\004\rAdministrator\200\vad_is_bogus UNCONSUMED")
1010
@result = str.read_ber!(Net::LDAP::AsnSyntax)
1111
end
12-
12+
1313
it "should correctly parse the ber message" do
1414
result.should == [1, [3, "Administrator", "ad_is_bogus"]]
15-
end
15+
end
1616
it "should leave unconsumed part of message in place" do
1717
str.should == " UNCONSUMED"
1818
end
@@ -21,9 +21,9 @@
2121
attr_reader :initial_value
2222
before(:each) do
2323
stub_exception_class = Class.new(StandardError)
24-
24+
2525
@initial_value = raw_string("0$\002\001\001`\037\002\001\003\004\rAdministrator\200\vad_is_bogus")
26-
@str = initial_value.dup
26+
@str = initial_value.dup
2727

2828
# Defines a string
2929
io = StringIO.new(initial_value)
@@ -32,16 +32,16 @@
3232
raise stub_exception_class
3333
end
3434
flexmock(StringIO).should_receive(:new).and_return(io)
35-
35+
3636
begin
37-
str.read_ber!(Net::LDAP::AsnSyntax)
37+
str.read_ber!(Net::LDAP::AsnSyntax)
3838
rescue stub_exception_class
3939
# EMPTY ON PURPOSE
4040
else
4141
raise "The stub code should raise an exception!"
4242
end
4343
end
44-
44+
4545
it "should not modify string" do
4646
str.should == initial_value
4747
end

0 commit comments

Comments
 (0)