diff --git a/.rspec b/.rspec index 1e5e5c9..8c18f1a 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,2 @@ ---format nested ---colour ---drb +--format documentation +--color diff --git a/lib/net/ntlm.rb b/lib/net/ntlm.rb index e6b6097..a95ac52 100644 --- a/lib/net/ntlm.rb +++ b/lib/net/ntlm.rb @@ -102,10 +102,11 @@ def gen_keys(str) end def apply_des(plain, keys) - dec = OpenSSL::Cipher::DES.new + dec = OpenSSL::Cipher::Cipher.new("des-cbc") + dec.padding = 0 keys.map {|k| dec.key = k - dec.encrypt.update(plain) + dec.encrypt.update(plain) + dec.final } end diff --git a/rubyntlm.gemspec b/rubyntlm.gemspec index 6476245..dade0c5 100644 --- a/rubyntlm.gemspec +++ b/rubyntlm.gemspec @@ -18,10 +18,10 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.required_ruby_version = '>= 1.8.7' - + s.license = 'MIT' s.add_development_dependency "rake" - s.add_development_dependency "rspec" + s.add_development_dependency "rspec", ">= 2.11" s.add_development_dependency "simplecov" end diff --git a/spec/lib/net/ntlm/encode_util_spec.rb b/spec/lib/net/ntlm/encode_util_spec.rb index 73d4f52..9f75707 100644 --- a/spec/lib/net/ntlm/encode_util_spec.rb +++ b/spec/lib/net/ntlm/encode_util_spec.rb @@ -4,13 +4,13 @@ context '#encode_utf16le' do it 'should convert an ASCII string to UTF' do - Net::NTLM::EncodeUtil.encode_utf16le('Test').should == "T\x00e\x00s\x00t\x00" + expect(Net::NTLM::EncodeUtil.encode_utf16le('Test')).to eq("T\x00e\x00s\x00t\x00") end end context '#decode_utf16le' do it 'should convert a UTF string to ASCII' do - Net::NTLM::EncodeUtil.decode_utf16le("T\x00e\x00s\x00t\x00").should == 'Test' + expect(Net::NTLM::EncodeUtil.decode_utf16le("T\x00e\x00s\x00t\x00")).to eq('Test') end end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/field_set_spec.rb b/spec/lib/net/ntlm/field_set_spec.rb index d27c1a0..4ca09ff 100644 --- a/spec/lib/net/ntlm/field_set_spec.rb +++ b/spec/lib/net/ntlm/field_set_spec.rb @@ -18,16 +18,16 @@ end it 'should serialize all the fields' do - fieldset_object.serialize.should == 'TestFoo' + expect(fieldset_object.serialize).to eq('TestFoo') end it 'should parse a string across the fields' do fieldset_object.parse('FooBarBaz') - fieldset_object.serialize.should == 'FooBarB' + expect(fieldset_object.serialize).to eq('FooBarB') end it 'should return an aggregate size of all the fields' do - fieldset_object.size.should == 7 + expect(fieldset_object.size).to eq(7) end end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/field_spec.rb b/spec/lib/net/ntlm/field_spec.rb index 31017e0..4a3ba3a 100644 --- a/spec/lib/net/ntlm/field_spec.rb +++ b/spec/lib/net/ntlm/field_spec.rb @@ -7,12 +7,12 @@ context 'with no size specified' do let (:field_without_size) { Net::NTLM::Field.new({ :value => 'Foo', :active => true }) } it 'should set size to 0 if not active' do - field_without_size.size.should == 0 + expect(field_without_size.size).to eq(0) end it 'should return 0 if active but no size specified' do field_without_size.active = true - field_without_size.size.should == 0 + expect(field_without_size.size).to eq(0) end end @@ -20,15 +20,15 @@ let (:field_with_size) { Net::NTLM::Field.new({ :value => 'Foo', :active => true, :size => 100 }) } it 'should return the size provided in the initialize options if active' do - field_with_size.size.should == 100 + expect(field_with_size.size).to eq(100) end it 'should still return 0 if not active' do field_with_size.active = false - field_with_size.size.should == 0 + expect(field_with_size.size).to eq(0) end end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/message/type1_spec.rb b/spec/lib/net/ntlm/message/type1_spec.rb index aeb982e..f40d222 100644 --- a/spec/lib/net/ntlm/message/type1_spec.rb +++ b/spec/lib/net/ntlm/message/type1_spec.rb @@ -24,19 +24,19 @@ it 'should deserialize' do t1 = Net::NTLM::Message.decode64(type1_packet) - t1.class.should == Net::NTLM::Message::Type1 - t1.domain.should == '' - t1.flag.should == 557575 - t1.padding.should == '' - t1.sign.should == "NTLMSSP\0" - t1.type.should == 1 - t1.workstation.should == '' + expect(t1.class).to eq(Net::NTLM::Message::Type1) + expect(t1.domain).to eq('') + expect(t1.flag).to eq(557575) + expect(t1.padding).to eq('') + expect(t1.sign).to eq("NTLMSSP\0") + expect(t1.type).to eq(1) + expect(t1.workstation).to eq('') end it 'should serialize' do t1 = Net::NTLM::Message::Type1.new t1.workstation = '' - t1.encode64.should == type1_packet + expect(t1.encode64).to eq(type1_packet) end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/message/type2_spec.rb b/spec/lib/net/ntlm/message/type2_spec.rb index 12226b7..88a5442 100644 --- a/spec/lib/net/ntlm/message/type2_spec.rb +++ b/spec/lib/net/ntlm/message/type2_spec.rb @@ -24,24 +24,24 @@ it 'should deserialize' do t2 = Net::NTLM::Message.decode64(type2_packet) - t2.class.should == Net::NTLM::Message::Type2 - t2.challenge.should == 14872292244261496103 - t2.context.should == 0 - t2.flag.should == 42631685 + expect(t2.class).to eq(Net::NTLM::Message::Type2) + expect(t2.challenge).to eq(14872292244261496103) + expect(t2.context).to eq(0) + expect(t2.flag).to eq(42631685) if "".respond_to?(:force_encoding) - t2.padding.should == ("\x06\x01\xB1\x1D\0\0\0\x0F".force_encoding('ASCII-8BIT')) + expect(t2.padding).to eq(("\x06\x01\xB1\x1D\0\0\0\x0F".force_encoding('ASCII-8BIT'))) end - t2.sign.should == "NTLMSSP\0" + expect(t2.sign).to eq("NTLMSSP\0") t2_target_info = Net::NTLM::EncodeUtil.decode_utf16le(t2.target_info) if RUBY_VERSION == "1.8.7" - t2_target_info.should == "\x02\x1CVAGRANT-2008R2\x01\x1CVAGRANT-2008R2\x04\x1Cvagrant-2008R2\x03\x1Cvagrant-2008R2\a\b\e$(D+&\e(B\0\0" + expect(t2_target_info).to eq("\x02\x1CVAGRANT-2008R2\x01\x1CVAGRANT-2008R2\x04\x1Cvagrant-2008R2\x03\x1Cvagrant-2008R2\a\b\e$(D+&\e(B\0\0") else - t2_target_info.should == "\u0002\u001CVAGRANT-2008R2\u0001\u001CVAGRANT-2008R2\u0004\u001Cvagrant-2008R2\u0003\u001Cvagrant-2008R2\a\b፤ᐝ❴ǎ\0\0" + expect(t2_target_info).to eq("\u0002\u001CVAGRANT-2008R2\u0001\u001CVAGRANT-2008R2\u0004\u001Cvagrant-2008R2\u0003\u001Cvagrant-2008R2\a\b፤ᐝ❴ǎ\0\0") end - Net::NTLM::EncodeUtil.decode_utf16le(t2.target_name).should == "VAGRANT-2008R2" - t2.type.should == 2 + expect(Net::NTLM::EncodeUtil.decode_utf16le(t2.target_name)).to eq("VAGRANT-2008R2") + expect(t2.type).to eq(2) end it 'should serialize' do @@ -60,7 +60,7 @@ t2.enable(:target_info) t2.enable(:padding) - t2.encode64.should == type2_packet + expect(t2.encode64).to eq(type2_packet) end it 'should generate a type 3 response' do @@ -72,17 +72,17 @@ type3_known.enable(:flag) t3 = t2.response({:user => 'vagrant', :password => 'vagrant', :domain => ''}, {:ntlmv2 => true, :workstation => 'kobe.local'}) - t3.domain.should == type3_known.domain - t3.flag.should == type3_known.flag - t3.sign.should == "NTLMSSP\0" - t3.workstation.should == "k\0o\0b\0e\0.\0l\0o\0c\0a\0l\0" - t3.user.should == "v\0a\0g\0r\0a\0n\0t\0" - t3.session_key.should == '' + expect(t3.domain).to eq(type3_known.domain) + expect(t3.flag).to eq(type3_known.flag) + expect(t3.sign).to eq("NTLMSSP\0") + expect(t3.workstation).to eq("k\0o\0b\0e\0.\0l\0o\0c\0a\0l\0") + expect(t3.user).to eq("v\0a\0g\0r\0a\0n\0t\0") + expect(t3.session_key).to eq('') end it 'should upcase domain when provided' do t2 = Net::NTLM::Message.decode64(type2_packet) t3 = t2.response({:user => 'vagrant', :password => 'vagrant', :domain => 'domain'}, {:ntlmv2 => true, :workstation => 'kobe.local'}) - t3.domain.should == "D\0O\0M\0A\0I\0N\0" + expect(t3.domain).to eq("D\0O\0M\0A\0I\0N\0") end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/message/type3_spec.rb b/spec/lib/net/ntlm/message/type3_spec.rb index 67b08b9..8e789a3 100644 --- a/spec/lib/net/ntlm/message/type3_spec.rb +++ b/spec/lib/net/ntlm/message/type3_spec.rb @@ -17,4 +17,4 @@ it_behaves_like 'a fieldset', fields it_behaves_like 'a message', flags -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/security_buffer_spec.rb b/spec/lib/net/ntlm/security_buffer_spec.rb index 1886ac1..e6a167b 100644 --- a/spec/lib/net/ntlm/security_buffer_spec.rb +++ b/spec/lib/net/ntlm/security_buffer_spec.rb @@ -24,26 +24,26 @@ domain_security_buffer.value = 'DOMAIN1' end it 'should change the value' do - domain_security_buffer.value.should == 'DOMAIN1' + expect(domain_security_buffer.value).to eq('DOMAIN1') end it 'should adjust the length field to the size of the new value' do - domain_security_buffer.length.should == 7 + expect(domain_security_buffer.length).to eq(7) end it 'should adjust the allocated field to the size of the new value' do - domain_security_buffer.allocated.should == 7 + expect(domain_security_buffer.allocated).to eq(7) end end context '#data_size' do it 'should return the size of the value if active' do - domain_security_buffer.data_size.should == 11 + expect(domain_security_buffer.data_size).to eq(11) end it 'should return 0 if inactive' do domain_security_buffer.active = false - domain_security_buffer.data_size.should == 0 + expect(domain_security_buffer.data_size).to eq(0) end end @@ -56,9 +56,9 @@ # The offset that the actual value begins at is also 8 offset = "\x08\x00\x00\x00" string_to_parse = "#{length}#{allocated}#{offset}FooBarBaz" - domain_security_buffer.parse(string_to_parse).should == 8 - domain_security_buffer.value.should == 'FooBarBa' + expect(domain_security_buffer.parse(string_to_parse)).to eq(8) + expect(domain_security_buffer.value).to eq('FooBarBa') end end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/string_spec.rb b/spec/lib/net/ntlm/string_spec.rb index 2de5588..5923b22 100644 --- a/spec/lib/net/ntlm/string_spec.rb +++ b/spec/lib/net/ntlm/string_spec.rb @@ -22,51 +22,51 @@ context '#serialize' do it 'should return the value when active' do - active.serialize.should == 'Test' + expect(active.serialize).to eq('Test') end it 'should return an empty string when inactive' do - inactive.serialize.should == '' + expect(inactive.serialize).to eq('') end it 'should coerce non-string values into strings' do active.value = 15 - active.serialize.should == '15' + expect(active.serialize).to eq('15') end it 'should return empty string on a nil' do active.value = nil - active.serialize.should == '' + expect(active.serialize).to eq('') end end context '#value=' do it 'should set active to false if it empty' do active.value = '' - active.active.should == false + expect(active.active).to eq(false) end it 'should adjust the size based on the value set' do - active.size.should == 4 + expect(active.size).to eq(4) active.value = 'Foobar' - active.size.should == 6 + expect(active.size).to eq(6) end end context '#parse' do it 'should read in a string of the proper size' do - active.parse('tseT').should == 4 - active.value.should == 'tseT' + expect(active.parse('tseT')).to eq(4) + expect(active.value).to eq('tseT') end it 'should not read in a string that is too small' do - active.parse('B').should == 0 - active.value.should == 'Test' + expect(active.parse('B')).to eq(0) + expect(active.value).to eq('Test') end it 'should be able to read from an offset and only for the given size' do - active.parse('FooBarBaz',3).should == 4 - active.value.should == 'BarB' + expect(active.parse('FooBarBaz',3)).to eq(4) + expect(active.value).to eq('BarB') end end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm/version_spec.rb b/spec/lib/net/ntlm/version_spec.rb index 3a00dd5..b0434d3 100644 --- a/spec/lib/net/ntlm/version_spec.rb +++ b/spec/lib/net/ntlm/version_spec.rb @@ -3,15 +3,15 @@ describe Net::NTLM::VERSION do it 'should contain an integer value for Major Version' do - Net::NTLM::VERSION::MAJOR.should be_an Integer + expect(Net::NTLM::VERSION::MAJOR).to be_an Integer end it 'should contain an integer value for Minor Version' do - Net::NTLM::VERSION::MINOR.should be_an Integer + expect(Net::NTLM::VERSION::MINOR).to be_an Integer end it 'should contain an integer value for Patch Version' do - Net::NTLM::VERSION::TINY.should be_an Integer + expect(Net::NTLM::VERSION::TINY).to be_an Integer end it 'should contain an aggregate version string' do @@ -20,7 +20,7 @@ Net::NTLM::VERSION::MINOR, Net::NTLM::VERSION::TINY ].join('.') - Net::NTLM::VERSION::STRING.should be_a String - Net::NTLM::VERSION::STRING.should == string + expect(Net::NTLM::VERSION::STRING).to be_a String + expect(Net::NTLM::VERSION::STRING).to eq(string) end -end \ No newline at end of file +end diff --git a/spec/lib/net/ntlm_spec.rb b/spec/lib/net/ntlm_spec.rb index 5c25f6c..bcc7f7b 100644 --- a/spec/lib/net/ntlm_spec.rb +++ b/spec/lib/net/ntlm_spec.rb @@ -22,68 +22,68 @@ let(:keys) { Net::NTLM.gen_keys(padded_pwd)} it 'should convert a value to 64-bit LE Integer' do - Net::NTLM.pack_int64le(42).should == "\x2A\x00\x00\x00\x00\x00\x00\x00" + expect(Net::NTLM.pack_int64le(42)).to eq("\x2A\x00\x00\x00\x00\x00\x00\x00") end it 'should split a string into an array of slices, 7 chars or less' do - Net::NTLM.split7("HelloWorld!").should == [ 'HelloWo', 'rld!'] + expect(Net::NTLM.split7("HelloWorld!")).to eq([ 'HelloWo', 'rld!']) end it 'should generate DES keys from the supplied string' do first_key = ["52a2516b252a5161"].pack('H*') second_key = ["3180010101010101"].pack('H*') - Net::NTLM.gen_keys(padded_pwd).should == [first_key, second_key] + expect(Net::NTLM.gen_keys(padded_pwd)).to eq([first_key, second_key]) end it 'should encrypt the string with DES for each key supplied' do first_crypt = ["ff3750bcc2b22412"].pack('H*') second_crypt = ["c2265b23734e0dac"].pack('H*') - Net::NTLM::apply_des(Net::NTLM::LM_MAGIC, keys).should == [first_crypt, second_crypt] + expect(Net::NTLM::apply_des(Net::NTLM::LM_MAGIC, keys)).to eq([first_crypt, second_crypt]) end it 'should generate an lm_hash' do - Net::NTLM::lm_hash(passwd).should == ["ff3750bcc2b22412c2265b23734e0dac"].pack("H*") + expect(Net::NTLM::lm_hash(passwd)).to eq(["ff3750bcc2b22412c2265b23734e0dac"].pack("H*")) end it 'should generate an ntlm_hash' do - Net::NTLM::ntlm_hash(passwd).should == ["cd06ca7c7e10c99b1d33b7485a2ed808"].pack("H*") + expect(Net::NTLM::ntlm_hash(passwd)).to eq(["cd06ca7c7e10c99b1d33b7485a2ed808"].pack("H*")) end it 'should generate an ntlmv2_hash' do - Net::NTLM::ntlmv2_hash(user, passwd, domain).should == ["04b8e0ba74289cc540826bab1dee63ae"].pack("H*") + expect(Net::NTLM::ntlmv2_hash(user, passwd, domain)).to eq(["04b8e0ba74289cc540826bab1dee63ae"].pack("H*")) end it 'should generate an lm_response' do - Net::NTLM::lm_response( + expect(Net::NTLM::lm_response( { :lm_hash => Net::NTLM::lm_hash(passwd), :challenge => challenge } - ).should == ["c337cd5cbd44fc9782a667af6d427c6de67c20c2d3e77c56"].pack("H*") + )).to eq(["c337cd5cbd44fc9782a667af6d427c6de67c20c2d3e77c56"].pack("H*")) end it 'should generate an ntlm_response' do ntlm_hash = Net::NTLM::ntlm_hash(passwd) - Net::NTLM::ntlm_response( + expect(Net::NTLM::ntlm_response( { :ntlm_hash => ntlm_hash, :challenge => challenge } - ).should == ["25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6"].pack("H*") + )).to eq(["25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6"].pack("H*")) end it 'should generate a lvm2_response' do - Net::NTLM::lmv2_response( + expect(Net::NTLM::lmv2_response( { :ntlmv2_hash => Net::NTLM::ntlmv2_hash(user, passwd, domain), :challenge => challenge }, { :client_challenge => client_ch } - ).should == ["d6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344"].pack("H*") + )).to eq(["d6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344"].pack("H*")) end it 'should generate a ntlmv2_response' do - Net::NTLM::ntlmv2_response( + expect(Net::NTLM::ntlmv2_response( { :ntlmv2_hash => Net::NTLM::ntlmv2_hash(user, passwd, domain), :challenge => challenge, @@ -93,7 +93,7 @@ :timestamp => timestamp, :client_challenge => client_ch } - ).should == [ + )).to eq([ "cbabbca713eb795d04c97abc01ee4983" + "01010000000000000090d336b734c301" + "ffffff00112233440000000002000c00" + @@ -104,7 +104,7 @@ "650072002e0064006f006d0061006900" + "6e002e0063006f006d00000000000000" + "0000" - ].pack("H*") + ].pack("H*")) end it 'should generate a ntlm2_session' do @@ -115,7 +115,7 @@ }, { :client_challenge => client_ch } ) - session[0].should == ["ffffff001122334400000000000000000000000000000000"].pack("H*") - session[1].should == ["10d550832d12b2ccb79d5ad1f4eed3df82aca4c3681dd455"].pack("H*") + expect(session[0]).to eq(["ffffff001122334400000000000000000000000000000000"].pack("H*")) + expect(session[1]).to eq(["10d550832d12b2ccb79d5ad1f4eed3df82aca4c3681dd455"].pack("H*")) end end diff --git a/spec/support/shared/examples/net/ntlm/field_shared.rb b/spec/support/shared/examples/net/ntlm/field_shared.rb index ab7f207..33d233a 100644 --- a/spec/support/shared/examples/net/ntlm/field_shared.rb +++ b/spec/support/shared/examples/net/ntlm/field_shared.rb @@ -15,11 +15,11 @@ it 'should set the value from initialize options' do - subject.value.should == value + expect(subject.value).to eq(value) end it 'should set active from initialize options' do - subject.active.should == active + expect(subject.active).to eq(active) end -end \ No newline at end of file +end diff --git a/spec/support/shared/examples/net/ntlm/fieldset_shared.rb b/spec/support/shared/examples/net/ntlm/fieldset_shared.rb index 2090e90..b5911bc 100644 --- a/spec/support/shared/examples/net/ntlm/fieldset_shared.rb +++ b/spec/support/shared/examples/net/ntlm/fieldset_shared.rb @@ -21,19 +21,19 @@ end it 'should set the prototypes correctly' do - fieldset_class.prototypes.should include([:test_string, Net::NTLM::String, {:value=>"Test"}]) + expect(fieldset_class.prototypes).to include([:test_string, Net::NTLM::String, {:value=>"Test"}]) end it 'should set the names correctly' do - fieldset_class.names.should include(:test_string) + expect(fieldset_class.names).to include(:test_string) end it 'should set the types correctly' do - fieldset_class.types.should include(Net::NTLM::String) + expect(fieldset_class.types).to include(Net::NTLM::String) end it 'should set the opts correctly' do - fieldset_class.opts.should include({:value => 'Test'}) + expect(fieldset_class.opts).to include({:value => 'Test'}) end context 'when creating an instance' do @@ -42,11 +42,11 @@ end it 'should have the new accessor' do - fieldset_object.should respond_to :test_string + expect(fieldset_object).to respond_to(:test_string) end it 'should have the correct default value' do - fieldset_object.test_string.should == 'Test' + expect(fieldset_object.test_string).to eq('Test') end end end @@ -57,19 +57,19 @@ end it 'should set the prototypes correctly' do - fieldset_class.prototypes.should include([:test_int, Net::NTLM::Int16LE, {:value=>15}]) + expect(fieldset_class.prototypes).to include([:test_int, Net::NTLM::Int16LE, {:value=>15}]) end it 'should set the names correctly' do - fieldset_class.names.should include(:test_int) + expect(fieldset_class.names).to include(:test_int) end it 'should set the types correctly' do - fieldset_class.types.should include(Net::NTLM::Int16LE) + expect(fieldset_class.types).to include(Net::NTLM::Int16LE) end it 'should set the opts correctly' do - fieldset_class.opts.should include({:value => 15}) + expect(fieldset_class.opts).to include({:value => 15}) end context 'when creating an instance' do @@ -78,11 +78,11 @@ end it 'should have the new accessor' do - fieldset_object.should respond_to :test_int + expect(fieldset_object).to respond_to(:test_int) end it 'should have the correct default value' do - fieldset_object.test_int.should == 15 + expect(fieldset_object.test_int).to eq(15) end end end @@ -93,19 +93,19 @@ end it 'should set the prototypes correctly' do - fieldset_class.prototypes.should include([:test_int, Net::NTLM::Int32LE, {:value=>15}]) + expect(fieldset_class.prototypes).to include([:test_int, Net::NTLM::Int32LE, {:value=>15}]) end it 'should set the names correctly' do - fieldset_class.names.should include(:test_int) + expect(fieldset_class.names).to include(:test_int) end it 'should set the types correctly' do - fieldset_class.types.should include(Net::NTLM::Int32LE) + expect(fieldset_class.types).to include(Net::NTLM::Int32LE) end it 'should set the opts correctly' do - fieldset_class.opts.should include({:value => 15}) + expect(fieldset_class.opts).to include({:value => 15}) end context 'when creating an instance' do @@ -114,11 +114,11 @@ end it 'should have the new accessor' do - fieldset_object.should respond_to :test_int + expect(fieldset_object).to respond_to(:test_int) end it 'should have the correct default value' do - fieldset_object.test_int.should == 15 + expect(fieldset_object.test_int).to eq(15) end end end @@ -129,19 +129,19 @@ end it 'should set the prototypes correctly' do - fieldset_class.prototypes.should include([:test_int, Net::NTLM::Int64LE, {:value=>15}]) + expect(fieldset_class.prototypes).to include([:test_int, Net::NTLM::Int64LE, {:value=>15}]) end it 'should set the names correctly' do - fieldset_class.names.should include(:test_int) + expect(fieldset_class.names).to include(:test_int) end it 'should set the types correctly' do - fieldset_class.types.should include(Net::NTLM::Int64LE) + expect(fieldset_class.types).to include(Net::NTLM::Int64LE) end it 'should set the opts correctly' do - fieldset_class.opts.should include({:value => 15}) + expect(fieldset_class.opts).to include({:value => 15}) end context 'when creating an instance' do @@ -150,11 +150,11 @@ end it 'should have the new accessor' do - fieldset_object.should respond_to :test_int + expect(fieldset_object).to respond_to(:test_int) end it 'should have the correct default value' do - fieldset_object.test_int.should == 15 + expect(fieldset_object.test_int).to eq(15) end end end @@ -165,19 +165,19 @@ end it 'should set the prototypes correctly' do - fieldset_class.prototypes.should include([:test_buffer, Net::NTLM::SecurityBuffer, {:value=>15}]) + expect(fieldset_class.prototypes).to include([:test_buffer, Net::NTLM::SecurityBuffer, {:value=>15}]) end it 'should set the names correctly' do - fieldset_class.names.should include(:test_buffer) + expect(fieldset_class.names).to include(:test_buffer) end it 'should set the types correctly' do - fieldset_class.types.should include(Net::NTLM::SecurityBuffer) + expect(fieldset_class.types).to include(Net::NTLM::SecurityBuffer) end it 'should set the opts correctly' do - fieldset_class.opts.should include({:value => 15}) + expect(fieldset_class.opts).to include({:value => 15}) end context 'when creating an instance' do @@ -186,11 +186,11 @@ end it 'should have the new accessor' do - fieldset_object.should respond_to :test_buffer + expect(fieldset_object).to respond_to :test_buffer end it 'should have the correct default value' do - fieldset_object.test_buffer.should == 15 + expect(fieldset_object.test_buffer).to eq(15) end end end @@ -221,19 +221,19 @@ context "#{field[:name]}" do it "should be a #{field[:class].to_s}" do - fieldset_object[field[:name]].class.should == field[:class] + expect(fieldset_object[field[:name]].class).to eq(field[:class]) end it "should have a default value of #{field[:value]}" do - fieldset_object[field[:name]].value.should == field[:value] + expect(fieldset_object[field[:name]].value).to eq(field[:value]) end it "should have active set to #{field[:active]}" do - fieldset_object[field[:name]].active.should == field[:active] + expect(fieldset_object[field[:name]].active).to eq(field[:active]) end end end end end -end \ No newline at end of file +end diff --git a/spec/support/shared/examples/net/ntlm/int_shared.rb b/spec/support/shared/examples/net/ntlm/int_shared.rb index 2f47b8e..1fb953b 100644 --- a/spec/support/shared/examples/net/ntlm/int_shared.rb +++ b/spec/support/shared/examples/net/ntlm/int_shared.rb @@ -9,7 +9,7 @@ context '#serialize' do it 'should serialize properly with an integer value' do - subject.serialize.should == values[:default_hex] + expect(subject.serialize).to eq(values[:default_hex]) end it 'should raise an Exception for a String' do @@ -25,19 +25,19 @@ context '#parse' do it "should parse a raw #{values[:bits].to_s}-bit integer from a string" do - subject.parse(values[:alt_hex]).should == values[:size] - subject.value.should == values[:alt] + expect(subject.parse(values[:alt_hex])).to eq(values[:size]) + expect(subject.value).to eq(values[:alt]) end it "should use an offset to find the #{values[:bits].to_s}-bit integer in the string" do - subject.parse("Value:#{values[:alt_hex]}",6).should == values[:size] - subject.value.should == values[:alt] + expect(subject.parse("Value:#{values[:alt_hex]}",6)).to eq(values[:size]) + expect(subject.value).to eq(values[:alt]) end it 'should return 0 and not change the value if the string is not big enough' do - subject.parse(values[:small]).should == 0 - subject.value.should == values[:default] + expect(subject.parse(values[:small])).to eq(0) + expect(subject.value).to eq(values[:default]) end end -end \ No newline at end of file +end diff --git a/spec/support/shared/examples/net/ntlm/message_shared.rb b/spec/support/shared/examples/net/ntlm/message_shared.rb index 84a92ba..dc02d31 100644 --- a/spec/support/shared/examples/net/ntlm/message_shared.rb +++ b/spec/support/shared/examples/net/ntlm/message_shared.rb @@ -21,15 +21,15 @@ flags.each do |flag| it "should be able to check if the #{flag} flag is set" do - test_message.has_flag?(flag).should == true + expect(test_message.has_flag?(flag)).to be(true) end end it 'should be able to set a new flag' do test_message.set_flag(:DOMAIN_SUPPLIED) - test_message.has_flag?(:DOMAIN_SUPPLIED).should == true + expect(test_message.has_flag?(:DOMAIN_SUPPLIED)).to be(true) end -end \ No newline at end of file +end