rubyntlm 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -3
- data/README.md +9 -2
- data/Rakefile +8 -0
- data/examples/http.rb +1 -1
- data/lib/net/ntlm.rb +10 -9
- data/lib/net/ntlm/blob.rb +17 -6
- data/lib/net/ntlm/client.rb +61 -0
- data/lib/net/ntlm/client/session.rb +223 -0
- data/lib/net/ntlm/encode_util.rb +2 -2
- data/lib/net/ntlm/field_set.rb +9 -5
- data/lib/net/ntlm/message.rb +23 -9
- data/lib/net/ntlm/message/type1.rb +1 -26
- data/lib/net/ntlm/message/type2.rb +11 -37
- data/lib/net/ntlm/message/type3.rb +77 -14
- data/lib/net/ntlm/version.rb +1 -1
- data/rubyntlm.gemspec +3 -2
- data/spec/lib/net/ntlm/blob_spec.rb +1 -1
- data/spec/lib/net/ntlm/client/session_spec.rb +68 -0
- data/spec/lib/net/ntlm/client_spec.rb +64 -0
- data/spec/lib/net/ntlm/encode_util_spec.rb +3 -3
- data/spec/lib/net/ntlm/field_set_spec.rb +4 -4
- data/spec/lib/net/ntlm/field_spec.rb +5 -5
- data/spec/lib/net/ntlm/message/type1_spec.rb +99 -10
- data/spec/lib/net/ntlm/message/type2_spec.rb +68 -24
- data/spec/lib/net/ntlm/message/type3_spec.rb +207 -2
- data/spec/lib/net/ntlm/security_buffer_spec.rb +8 -8
- data/spec/lib/net/ntlm/string_spec.rb +14 -14
- data/spec/lib/net/ntlm/version_spec.rb +7 -6
- data/spec/lib/net/ntlm_spec.rb +20 -22
- data/spec/spec_helper.rb +1 -2
- data/spec/support/shared/examples/net/ntlm/field_shared.rb +3 -3
- data/spec/support/shared/examples/net/ntlm/fieldset_shared.rb +34 -34
- data/spec/support/shared/examples/net/ntlm/int_shared.rb +8 -8
- data/spec/support/shared/examples/net/ntlm/message_shared.rb +3 -3
- metadata +36 -16
@@ -24,26 +24,26 @@ describe Net::NTLM::SecurityBuffer do
|
|
24
24
|
domain_security_buffer.value = 'DOMAIN1'
|
25
25
|
end
|
26
26
|
it 'should change the value' do
|
27
|
-
domain_security_buffer.value.
|
27
|
+
expect(domain_security_buffer.value).to eq('DOMAIN1')
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should adjust the length field to the size of the new value' do
|
31
|
-
domain_security_buffer.length.
|
31
|
+
expect(domain_security_buffer.length).to eq(7)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should adjust the allocated field to the size of the new value' do
|
35
|
-
domain_security_buffer.allocated.
|
35
|
+
expect(domain_security_buffer.allocated).to eq(7)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
context '#data_size' do
|
40
40
|
it 'should return the size of the value if active' do
|
41
|
-
domain_security_buffer.data_size.
|
41
|
+
expect(domain_security_buffer.data_size).to eq(11)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should return 0 if inactive' do
|
45
45
|
domain_security_buffer.active = false
|
46
|
-
domain_security_buffer.data_size.
|
46
|
+
expect(domain_security_buffer.data_size).to eq(0)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -56,9 +56,9 @@ describe Net::NTLM::SecurityBuffer do
|
|
56
56
|
# The offset that the actual value begins at is also 8
|
57
57
|
offset = "\x08\x00\x00\x00"
|
58
58
|
string_to_parse = "#{length}#{allocated}#{offset}FooBarBaz"
|
59
|
-
domain_security_buffer.parse(string_to_parse).
|
60
|
-
domain_security_buffer.value.
|
59
|
+
expect(domain_security_buffer.parse(string_to_parse)).to eq(8)
|
60
|
+
expect(domain_security_buffer.value).to eq('FooBarBa')
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
@@ -22,51 +22,51 @@ describe Net::NTLM::String do
|
|
22
22
|
|
23
23
|
context '#serialize' do
|
24
24
|
it 'should return the value when active' do
|
25
|
-
active.serialize.
|
25
|
+
expect(active.serialize).to eq('Test')
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should return an empty string when inactive' do
|
29
|
-
inactive.serialize.
|
29
|
+
expect(inactive.serialize).to eq('')
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should coerce non-string values into strings' do
|
33
33
|
active.value = 15
|
34
|
-
active.serialize.
|
34
|
+
expect(active.serialize).to eq('15')
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should return empty string on a nil' do
|
38
38
|
active.value = nil
|
39
|
-
active.serialize.
|
39
|
+
expect(active.serialize).to eq('')
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
context '#value=' do
|
44
44
|
it 'should set active to false if it empty' do
|
45
45
|
active.value = ''
|
46
|
-
active.active.
|
46
|
+
expect(active.active).to eq(false)
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should adjust the size based on the value set' do
|
50
|
-
active.size.
|
50
|
+
expect(active.size).to eq(4)
|
51
51
|
active.value = 'Foobar'
|
52
|
-
active.size.
|
52
|
+
expect(active.size).to eq(6)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
context '#parse' do
|
57
57
|
it 'should read in a string of the proper size' do
|
58
|
-
active.parse('tseT').
|
59
|
-
active.value.
|
58
|
+
expect(active.parse('tseT')).to eq(4)
|
59
|
+
expect(active.value).to eq('tseT')
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'should not read in a string that is too small' do
|
63
|
-
active.parse('B').
|
64
|
-
active.value.
|
63
|
+
expect(active.parse('B')).to eq(0)
|
64
|
+
expect(active.value).to eq('Test')
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should be able to read from an offset and only for the given size' do
|
68
|
-
active.parse('FooBarBaz',3).
|
69
|
-
active.value.
|
68
|
+
expect(active.parse('FooBarBaz',3)).to eq(4)
|
69
|
+
expect(active.value).to eq('BarB')
|
70
70
|
end
|
71
71
|
end
|
72
|
-
end
|
72
|
+
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../../../../lib/net/ntlm/version")
|
2
3
|
|
3
4
|
describe Net::NTLM::VERSION do
|
4
5
|
|
5
6
|
it 'should contain an integer value for Major Version' do
|
6
|
-
Net::NTLM::VERSION::MAJOR.
|
7
|
+
expect(Net::NTLM::VERSION::MAJOR).to be_an Integer
|
7
8
|
end
|
8
9
|
|
9
10
|
it 'should contain an integer value for Minor Version' do
|
10
|
-
Net::NTLM::VERSION::MINOR.
|
11
|
+
expect(Net::NTLM::VERSION::MINOR).to be_an Integer
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should contain an integer value for Patch Version' do
|
14
|
-
Net::NTLM::VERSION::TINY.
|
15
|
+
expect(Net::NTLM::VERSION::TINY).to be_an Integer
|
15
16
|
end
|
16
17
|
|
17
18
|
it 'should contain an aggregate version string' do
|
@@ -20,7 +21,7 @@ describe Net::NTLM::VERSION do
|
|
20
21
|
Net::NTLM::VERSION::MINOR,
|
21
22
|
Net::NTLM::VERSION::TINY
|
22
23
|
].join('.')
|
23
|
-
Net::NTLM::VERSION::STRING.
|
24
|
-
Net::NTLM::VERSION::STRING.
|
24
|
+
expect(Net::NTLM::VERSION::STRING).to be_a String
|
25
|
+
expect(Net::NTLM::VERSION::STRING).to eq(string)
|
25
26
|
end
|
26
|
-
end
|
27
|
+
end
|
data/spec/lib/net/ntlm_spec.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
require 'rspec'
|
3
|
-
require 'net/ntlm'
|
1
|
+
require "spec_helper"
|
4
2
|
|
5
3
|
describe Net::NTLM do
|
6
4
|
let(:passwd) {"SecREt01"}
|
7
5
|
let(:user) {"user"}
|
8
|
-
let(:domain) {"
|
6
|
+
let(:domain) {"DOMAIN"}
|
9
7
|
let(:challenge) {["0123456789abcdef"].pack("H*")}
|
10
8
|
let(:client_ch) {["ffffff0011223344"].pack("H*")}
|
11
9
|
let(:timestamp) {1055844000}
|
@@ -22,68 +20,68 @@ describe Net::NTLM do
|
|
22
20
|
let(:keys) { Net::NTLM.gen_keys(padded_pwd)}
|
23
21
|
|
24
22
|
it 'should convert a value to 64-bit LE Integer' do
|
25
|
-
Net::NTLM.pack_int64le(42).
|
23
|
+
expect(Net::NTLM.pack_int64le(42)).to eq("\x2A\x00\x00\x00\x00\x00\x00\x00")
|
26
24
|
end
|
27
25
|
|
28
26
|
it 'should split a string into an array of slices, 7 chars or less' do
|
29
|
-
Net::NTLM.split7("HelloWorld!").
|
27
|
+
expect(Net::NTLM.split7("HelloWorld!")).to eq([ 'HelloWo', 'rld!'])
|
30
28
|
end
|
31
29
|
|
32
30
|
it 'should generate DES keys from the supplied string' do
|
33
31
|
first_key = ["52a2516b252a5161"].pack('H*')
|
34
32
|
second_key = ["3180010101010101"].pack('H*')
|
35
|
-
Net::NTLM.gen_keys(padded_pwd).
|
33
|
+
expect(Net::NTLM.gen_keys(padded_pwd)).to eq([first_key, second_key])
|
36
34
|
end
|
37
35
|
|
38
36
|
it 'should encrypt the string with DES for each key supplied' do
|
39
37
|
first_crypt = ["ff3750bcc2b22412"].pack('H*')
|
40
38
|
second_crypt = ["c2265b23734e0dac"].pack('H*')
|
41
|
-
Net::NTLM::apply_des(Net::NTLM::LM_MAGIC, keys).
|
39
|
+
expect(Net::NTLM::apply_des(Net::NTLM::LM_MAGIC, keys)).to eq([first_crypt, second_crypt])
|
42
40
|
end
|
43
41
|
|
44
42
|
it 'should generate an lm_hash' do
|
45
|
-
Net::NTLM::lm_hash(passwd).
|
43
|
+
expect(Net::NTLM::lm_hash(passwd)).to eq(["ff3750bcc2b22412c2265b23734e0dac"].pack("H*"))
|
46
44
|
end
|
47
45
|
|
48
46
|
it 'should generate an ntlm_hash' do
|
49
|
-
Net::NTLM::ntlm_hash(passwd).
|
47
|
+
expect(Net::NTLM::ntlm_hash(passwd)).to eq(["cd06ca7c7e10c99b1d33b7485a2ed808"].pack("H*"))
|
50
48
|
end
|
51
49
|
|
52
50
|
it 'should generate an ntlmv2_hash' do
|
53
|
-
Net::NTLM::ntlmv2_hash(user, passwd, domain).
|
51
|
+
expect(Net::NTLM::ntlmv2_hash(user, passwd, domain)).to eq(["04b8e0ba74289cc540826bab1dee63ae"].pack("H*"))
|
54
52
|
end
|
55
53
|
|
56
54
|
it 'should generate an lm_response' do
|
57
|
-
Net::NTLM::lm_response(
|
55
|
+
expect(Net::NTLM::lm_response(
|
58
56
|
{
|
59
57
|
:lm_hash => Net::NTLM::lm_hash(passwd),
|
60
58
|
:challenge => challenge
|
61
59
|
}
|
62
|
-
).
|
60
|
+
)).to eq(["c337cd5cbd44fc9782a667af6d427c6de67c20c2d3e77c56"].pack("H*"))
|
63
61
|
end
|
64
62
|
|
65
63
|
it 'should generate an ntlm_response' do
|
66
64
|
ntlm_hash = Net::NTLM::ntlm_hash(passwd)
|
67
|
-
Net::NTLM::ntlm_response(
|
65
|
+
expect(Net::NTLM::ntlm_response(
|
68
66
|
{
|
69
67
|
:ntlm_hash => ntlm_hash,
|
70
68
|
:challenge => challenge
|
71
69
|
}
|
72
|
-
).
|
70
|
+
)).to eq(["25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6"].pack("H*"))
|
73
71
|
end
|
74
72
|
|
75
73
|
it 'should generate a lvm2_response' do
|
76
|
-
Net::NTLM::lmv2_response(
|
74
|
+
expect(Net::NTLM::lmv2_response(
|
77
75
|
{
|
78
76
|
:ntlmv2_hash => Net::NTLM::ntlmv2_hash(user, passwd, domain),
|
79
77
|
:challenge => challenge
|
80
78
|
},
|
81
79
|
{ :client_challenge => client_ch }
|
82
|
-
).
|
80
|
+
)).to eq(["d6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344"].pack("H*"))
|
83
81
|
end
|
84
82
|
|
85
83
|
it 'should generate a ntlmv2_response' do
|
86
|
-
Net::NTLM::ntlmv2_response(
|
84
|
+
expect(Net::NTLM::ntlmv2_response(
|
87
85
|
{
|
88
86
|
:ntlmv2_hash => Net::NTLM::ntlmv2_hash(user, passwd, domain),
|
89
87
|
:challenge => challenge,
|
@@ -93,7 +91,7 @@ describe Net::NTLM do
|
|
93
91
|
:timestamp => timestamp,
|
94
92
|
:client_challenge => client_ch
|
95
93
|
}
|
96
|
-
).
|
94
|
+
)).to eq([
|
97
95
|
"cbabbca713eb795d04c97abc01ee4983" +
|
98
96
|
"01010000000000000090d336b734c301" +
|
99
97
|
"ffffff00112233440000000002000c00" +
|
@@ -104,7 +102,7 @@ describe Net::NTLM do
|
|
104
102
|
"650072002e0064006f006d0061006900" +
|
105
103
|
"6e002e0063006f006d00000000000000" +
|
106
104
|
"0000"
|
107
|
-
].pack("H*")
|
105
|
+
].pack("H*"))
|
108
106
|
end
|
109
107
|
|
110
108
|
it 'should generate a ntlm2_session' do
|
@@ -115,7 +113,7 @@ describe Net::NTLM do
|
|
115
113
|
},
|
116
114
|
{ :client_challenge => client_ch }
|
117
115
|
)
|
118
|
-
session[0].
|
119
|
-
session[1].
|
116
|
+
expect(session[0]).to eq(["ffffff001122334400000000000000000000000000000000"].pack("H*"))
|
117
|
+
expect(session[1]).to eq(["10d550832d12b2ccb79d5ad1f4eed3df82aca4c3681dd455"].pack("H*"))
|
120
118
|
end
|
121
119
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,6 @@ SimpleCov.start do
|
|
5
5
|
add_filter '/vendor/'
|
6
6
|
end if ENV["COVERAGE"]
|
7
7
|
|
8
|
-
|
9
8
|
require 'rspec'
|
10
9
|
require 'net/ntlm'
|
11
10
|
|
@@ -18,4 +17,4 @@ support_glob = root_pathname.join('spec', 'support', '**', '*.rb')
|
|
18
17
|
|
19
18
|
Dir.glob(support_glob) do |path|
|
20
19
|
require path
|
21
|
-
end
|
20
|
+
end
|
@@ -15,11 +15,11 @@ shared_examples_for 'a field' do | value, active|
|
|
15
15
|
|
16
16
|
|
17
17
|
it 'should set the value from initialize options' do
|
18
|
-
subject.value.
|
18
|
+
expect(subject.value).to eq(value)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should set active from initialize options' do
|
22
|
-
subject.active.
|
22
|
+
expect(subject.active).to eq(active)
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -21,19 +21,19 @@ shared_examples_for 'a fieldset' do |fields|
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should set the prototypes correctly' do
|
24
|
-
fieldset_class.prototypes.
|
24
|
+
expect(fieldset_class.prototypes).to include([:test_string, Net::NTLM::String, {:value=>"Test"}])
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should set the names correctly' do
|
28
|
-
fieldset_class.names.
|
28
|
+
expect(fieldset_class.names).to include(:test_string)
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should set the types correctly' do
|
32
|
-
fieldset_class.types.
|
32
|
+
expect(fieldset_class.types).to include(Net::NTLM::String)
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should set the opts correctly' do
|
36
|
-
fieldset_class.opts.
|
36
|
+
expect(fieldset_class.opts).to include({:value => 'Test'})
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when creating an instance' do
|
@@ -42,11 +42,11 @@ shared_examples_for 'a fieldset' do |fields|
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should have the new accessor' do
|
45
|
-
fieldset_object.
|
45
|
+
expect(fieldset_object).to respond_to(:test_string)
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should have the correct default value' do
|
49
|
-
fieldset_object.test_string.
|
49
|
+
expect(fieldset_object.test_string).to eq('Test')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -57,19 +57,19 @@ shared_examples_for 'a fieldset' do |fields|
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should set the prototypes correctly' do
|
60
|
-
fieldset_class.prototypes.
|
60
|
+
expect(fieldset_class.prototypes).to include([:test_int, Net::NTLM::Int16LE, {:value=>15}])
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should set the names correctly' do
|
64
|
-
fieldset_class.names.
|
64
|
+
expect(fieldset_class.names).to include(:test_int)
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should set the types correctly' do
|
68
|
-
fieldset_class.types.
|
68
|
+
expect(fieldset_class.types).to include(Net::NTLM::Int16LE)
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should set the opts correctly' do
|
72
|
-
fieldset_class.opts.
|
72
|
+
expect(fieldset_class.opts).to include({:value => 15})
|
73
73
|
end
|
74
74
|
|
75
75
|
context 'when creating an instance' do
|
@@ -78,11 +78,11 @@ shared_examples_for 'a fieldset' do |fields|
|
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'should have the new accessor' do
|
81
|
-
fieldset_object.
|
81
|
+
expect(fieldset_object).to respond_to(:test_int)
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should have the correct default value' do
|
85
|
-
fieldset_object.test_int.
|
85
|
+
expect(fieldset_object.test_int).to eq(15)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -93,19 +93,19 @@ shared_examples_for 'a fieldset' do |fields|
|
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should set the prototypes correctly' do
|
96
|
-
fieldset_class.prototypes.
|
96
|
+
expect(fieldset_class.prototypes).to include([:test_int, Net::NTLM::Int32LE, {:value=>15}])
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'should set the names correctly' do
|
100
|
-
fieldset_class.names.
|
100
|
+
expect(fieldset_class.names).to include(:test_int)
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should set the types correctly' do
|
104
|
-
fieldset_class.types.
|
104
|
+
expect(fieldset_class.types).to include(Net::NTLM::Int32LE)
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'should set the opts correctly' do
|
108
|
-
fieldset_class.opts.
|
108
|
+
expect(fieldset_class.opts).to include({:value => 15})
|
109
109
|
end
|
110
110
|
|
111
111
|
context 'when creating an instance' do
|
@@ -114,11 +114,11 @@ shared_examples_for 'a fieldset' do |fields|
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'should have the new accessor' do
|
117
|
-
fieldset_object.
|
117
|
+
expect(fieldset_object).to respond_to(:test_int)
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'should have the correct default value' do
|
121
|
-
fieldset_object.test_int.
|
121
|
+
expect(fieldset_object.test_int).to eq(15)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -129,19 +129,19 @@ shared_examples_for 'a fieldset' do |fields|
|
|
129
129
|
end
|
130
130
|
|
131
131
|
it 'should set the prototypes correctly' do
|
132
|
-
fieldset_class.prototypes.
|
132
|
+
expect(fieldset_class.prototypes).to include([:test_int, Net::NTLM::Int64LE, {:value=>15}])
|
133
133
|
end
|
134
134
|
|
135
135
|
it 'should set the names correctly' do
|
136
|
-
fieldset_class.names.
|
136
|
+
expect(fieldset_class.names).to include(:test_int)
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'should set the types correctly' do
|
140
|
-
fieldset_class.types.
|
140
|
+
expect(fieldset_class.types).to include(Net::NTLM::Int64LE)
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'should set the opts correctly' do
|
144
|
-
fieldset_class.opts.
|
144
|
+
expect(fieldset_class.opts).to include({:value => 15})
|
145
145
|
end
|
146
146
|
|
147
147
|
context 'when creating an instance' do
|
@@ -150,11 +150,11 @@ shared_examples_for 'a fieldset' do |fields|
|
|
150
150
|
end
|
151
151
|
|
152
152
|
it 'should have the new accessor' do
|
153
|
-
fieldset_object.
|
153
|
+
expect(fieldset_object).to respond_to(:test_int)
|
154
154
|
end
|
155
155
|
|
156
156
|
it 'should have the correct default value' do
|
157
|
-
fieldset_object.test_int.
|
157
|
+
expect(fieldset_object.test_int).to eq(15)
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|
@@ -165,19 +165,19 @@ shared_examples_for 'a fieldset' do |fields|
|
|
165
165
|
end
|
166
166
|
|
167
167
|
it 'should set the prototypes correctly' do
|
168
|
-
fieldset_class.prototypes.
|
168
|
+
expect(fieldset_class.prototypes).to include([:test_buffer, Net::NTLM::SecurityBuffer, {:value=>15}])
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'should set the names correctly' do
|
172
|
-
fieldset_class.names.
|
172
|
+
expect(fieldset_class.names).to include(:test_buffer)
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'should set the types correctly' do
|
176
|
-
fieldset_class.types.
|
176
|
+
expect(fieldset_class.types).to include(Net::NTLM::SecurityBuffer)
|
177
177
|
end
|
178
178
|
|
179
179
|
it 'should set the opts correctly' do
|
180
|
-
fieldset_class.opts.
|
180
|
+
expect(fieldset_class.opts).to include({:value => 15})
|
181
181
|
end
|
182
182
|
|
183
183
|
context 'when creating an instance' do
|
@@ -186,11 +186,11 @@ shared_examples_for 'a fieldset' do |fields|
|
|
186
186
|
end
|
187
187
|
|
188
188
|
it 'should have the new accessor' do
|
189
|
-
fieldset_object.
|
189
|
+
expect(fieldset_object).to respond_to :test_buffer
|
190
190
|
end
|
191
191
|
|
192
192
|
it 'should have the correct default value' do
|
193
|
-
fieldset_object.test_buffer.
|
193
|
+
expect(fieldset_object.test_buffer).to eq(15)
|
194
194
|
end
|
195
195
|
end
|
196
196
|
end
|
@@ -221,19 +221,19 @@ shared_examples_for 'a fieldset' do |fields|
|
|
221
221
|
|
222
222
|
context "#{field[:name]}" do
|
223
223
|
it "should be a #{field[:class].to_s}" do
|
224
|
-
fieldset_object[field[:name]].class.
|
224
|
+
expect(fieldset_object[field[:name]].class).to eq(field[:class])
|
225
225
|
end
|
226
226
|
|
227
227
|
it "should have a default value of #{field[:value]}" do
|
228
|
-
fieldset_object[field[:name]].value.
|
228
|
+
expect(fieldset_object[field[:name]].value).to eq(field[:value])
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should have active set to #{field[:active]}" do
|
232
|
-
fieldset_object[field[:name]].active.
|
232
|
+
expect(fieldset_object[field[:name]].active).to eq(field[:active])
|
233
233
|
end
|
234
234
|
end
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
238
|
end
|
239
|
-
end
|
239
|
+
end
|