diff options
Diffstat (limited to 'spec/ruby/library/digest/sha384')
18 files changed, 54 insertions, 66 deletions
diff --git a/spec/ruby/library/digest/sha384/append_spec.rb b/spec/ruby/library/digest/sha384/append_spec.rb index d694812e85..b9a862f1c2 100644 --- a/spec/ruby/library/digest/sha384/append_spec.rb +++ b/spec/ruby/library/digest/sha384/append_spec.rb @@ -1,7 +1,10 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) -require File.expand_path('../shared/update', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#<<" do - it_behaves_like(:sha384_update, :<<) + it "can update" do + cur_digest = Digest::SHA384.new + cur_digest << SHA384Constants::Contents + cur_digest.digest.should == SHA384Constants::Digest + end end diff --git a/spec/ruby/library/digest/sha384/block_length_spec.rb b/spec/ruby/library/digest/sha384/block_length_spec.rb index 070715b27e..dff645ffb9 100644 --- a/spec/ruby/library/digest/sha384/block_length_spec.rb +++ b/spec/ruby/library/digest/sha384/block_length_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#block_length" do @@ -9,4 +9,3 @@ describe "Digest::SHA384#block_length" do end end - diff --git a/spec/ruby/library/digest/sha384/digest_bang_spec.rb b/spec/ruby/library/digest/sha384/digest_bang_spec.rb index 83b68ae7c2..8711913deb 100644 --- a/spec/ruby/library/digest/sha384/digest_bang_spec.rb +++ b/spec/ruby/library/digest/sha384/digest_bang_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#digest!" do diff --git a/spec/ruby/library/digest/sha384/digest_length_spec.rb b/spec/ruby/library/digest/sha384/digest_length_spec.rb index a57616b44c..4067dd34af 100644 --- a/spec/ruby/library/digest/sha384/digest_length_spec.rb +++ b/spec/ruby/library/digest/sha384/digest_length_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#digest_length" do @@ -9,4 +9,3 @@ describe "Digest::SHA384#digest_length" do end end - diff --git a/spec/ruby/library/digest/sha384/digest_spec.rb b/spec/ruby/library/digest/sha384/digest_spec.rb index 3a5cd3a5d7..d0e2825934 100644 --- a/spec/ruby/library/digest/sha384/digest_spec.rb +++ b/spec/ruby/library/digest/sha384/digest_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#digest" do diff --git a/spec/ruby/library/digest/sha384/equal_spec.rb b/spec/ruby/library/digest/sha384/equal_spec.rb index a54d328edc..5d3483d79a 100644 --- a/spec/ruby/library/digest/sha384/equal_spec.rb +++ b/spec/ruby/library/digest/sha384/equal_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#==" do @@ -34,4 +34,3 @@ describe "Digest::SHA384#==" do end end - diff --git a/spec/ruby/library/digest/sha384/file_spec.rb b/spec/ruby/library/digest/sha384/file_spec.rb index 7e7c8f9565..3726ad4423 100644 --- a/spec/ruby/library/digest/sha384/file_spec.rb +++ b/spec/ruby/library/digest/sha384/file_spec.rb @@ -1,6 +1,6 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) -require File.expand_path('../../../../core/file/shared/read', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' +require_relative '../../../core/file/shared/read' describe "Digest::SHA384.file" do @@ -15,7 +15,7 @@ describe "Digest::SHA384.file" do end it "returns a Digest::SHA384 object" do - Digest::SHA384.file(@file).should be_kind_of(Digest::SHA384) + Digest::SHA384.file(@file).should.is_a?(Digest::SHA384) end it "returns a Digest::SHA384 object with the correct digest" do @@ -26,7 +26,7 @@ describe "Digest::SHA384.file" do obj = mock("to_str") obj.should_receive(:to_str).and_return(@file) result = Digest::SHA384.file(obj) - result.should be_kind_of(Digest::SHA384) + result.should.is_a?(Digest::SHA384) result.digest.should == SHA384Constants::Digest end end @@ -34,10 +34,10 @@ describe "Digest::SHA384.file" do it_behaves_like :file_read_directory, :file, Digest::SHA384 it "raises a Errno::ENOENT when passed a path that does not exist" do - lambda { Digest::SHA384.file("") }.should raise_error(Errno::ENOENT) + -> { Digest::SHA384.file("") }.should.raise(Errno::ENOENT) end it "raises a TypeError when passed nil" do - lambda { Digest::SHA384.file(nil) }.should raise_error(TypeError) + -> { Digest::SHA384.file(nil) }.should.raise(TypeError) end end diff --git a/spec/ruby/library/digest/sha384/hexdigest_bang_spec.rb b/spec/ruby/library/digest/sha384/hexdigest_bang_spec.rb index 68da8c7200..8efceec3eb 100644 --- a/spec/ruby/library/digest/sha384/hexdigest_bang_spec.rb +++ b/spec/ruby/library/digest/sha384/hexdigest_bang_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#hexdigest!" do diff --git a/spec/ruby/library/digest/sha384/hexdigest_spec.rb b/spec/ruby/library/digest/sha384/hexdigest_spec.rb index a7724d1663..07ea05c541 100644 --- a/spec/ruby/library/digest/sha384/hexdigest_spec.rb +++ b/spec/ruby/library/digest/sha384/hexdigest_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#hexdigest" do diff --git a/spec/ruby/library/digest/sha384/inspect_spec.rb b/spec/ruby/library/digest/sha384/inspect_spec.rb index 554a22d135..8f9f946cc5 100644 --- a/spec/ruby/library/digest/sha384/inspect_spec.rb +++ b/spec/ruby/library/digest/sha384/inspect_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#inspect" do @@ -9,4 +9,3 @@ describe "Digest::SHA384#inspect" do end end - diff --git a/spec/ruby/library/digest/sha384/length_spec.rb b/spec/ruby/library/digest/sha384/length_spec.rb index 63a57ce9ca..e5cd6131fd 100644 --- a/spec/ruby/library/digest/sha384/length_spec.rb +++ b/spec/ruby/library/digest/sha384/length_spec.rb @@ -1,8 +1,11 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) -require File.expand_path('../shared/length', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#length" do - it_behaves_like :sha384_length, :length + it "returns the length of the digest" do + cur_digest = Digest::SHA384.new + cur_digest.length.should == SHA384Constants::BlankDigest.size + cur_digest << SHA384Constants::Contents + cur_digest.length.should == SHA384Constants::Digest.size + end end - diff --git a/spec/ruby/library/digest/sha384/reset_spec.rb b/spec/ruby/library/digest/sha384/reset_spec.rb index 8abe39d7e2..991b90903d 100644 --- a/spec/ruby/library/digest/sha384/reset_spec.rb +++ b/spec/ruby/library/digest/sha384/reset_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#reset" do @@ -12,4 +12,3 @@ describe "Digest::SHA384#reset" do end end - diff --git a/spec/ruby/library/digest/sha384/shared/constants.rb b/spec/ruby/library/digest/sha384/shared/constants.rb index 3697384fc3..a78d571d26 100644 --- a/spec/ruby/library/digest/sha384/shared/constants.rb +++ b/spec/ruby/library/digest/sha384/shared/constants.rb @@ -1,4 +1,4 @@ -# -*- encoding: binary -*- +# encoding: binary require 'digest/sha2' @@ -14,5 +14,6 @@ module SHA384Constants Digest = "B&\266:\314\216z\361!TD\001{`\355\323\320MW%\270\272\0034n\034\026g\a\217\"\333s\202\275\002Y*\217]\207u\f\034\244\231\266f" BlankHexdigest = "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b" Hexdigest = "4226b63acc8e7af1215444017b60edd3d04d5725b8ba03346e1c1667078f22db7382bd02592a8f5d87750c1ca499b666" + Base64digest = "Qia2OsyOevEhVEQBe2Dt09BNVyW4ugM0bhwWZwePIttzgr0CWSqPXYd1DBykmbZm" end diff --git a/spec/ruby/library/digest/sha384/shared/length.rb b/spec/ruby/library/digest/sha384/shared/length.rb deleted file mode 100644 index 0c88288bcf..0000000000 --- a/spec/ruby/library/digest/sha384/shared/length.rb +++ /dev/null @@ -1,8 +0,0 @@ -describe :sha384_length, shared: true do - it "returns the length of the digest" do - cur_digest = Digest::SHA384.new - cur_digest.send(@method).should == SHA384Constants::BlankDigest.size - cur_digest << SHA384Constants::Contents - cur_digest.send(@method).should == SHA384Constants::Digest.size - end -end diff --git a/spec/ruby/library/digest/sha384/shared/update.rb b/spec/ruby/library/digest/sha384/shared/update.rb deleted file mode 100644 index 1c6e31cf6a..0000000000 --- a/spec/ruby/library/digest/sha384/shared/update.rb +++ /dev/null @@ -1,7 +0,0 @@ -describe :sha384_update, shared: true do - it "can update" do - cur_digest = Digest::SHA384.new - cur_digest.send @method, SHA384Constants::Contents - cur_digest.digest.should == SHA384Constants::Digest - end -end diff --git a/spec/ruby/library/digest/sha384/size_spec.rb b/spec/ruby/library/digest/sha384/size_spec.rb index 9aea3ef592..40c291c623 100644 --- a/spec/ruby/library/digest/sha384/size_spec.rb +++ b/spec/ruby/library/digest/sha384/size_spec.rb @@ -1,8 +1,8 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) -require File.expand_path('../shared/length', __FILE__) +require_relative '../../../spec_helper' +require 'digest' describe "Digest::SHA384#size" do - it_behaves_like :sha384_length, :size + it "is an alias of Digest::SHA384#length" do + Digest::SHA384.instance_method(:size).should == Digest::SHA384.instance_method(:length) + end end - diff --git a/spec/ruby/library/digest/sha384/to_s_spec.rb b/spec/ruby/library/digest/sha384/to_s_spec.rb index f45f2ee915..68ea9c013f 100644 --- a/spec/ruby/library/digest/sha384/to_s_spec.rb +++ b/spec/ruby/library/digest/sha384/to_s_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) +require_relative '../../../spec_helper' +require_relative 'shared/constants' describe "Digest::SHA384#to_s" do diff --git a/spec/ruby/library/digest/sha384/update_spec.rb b/spec/ruby/library/digest/sha384/update_spec.rb index 9917f86b86..561dcad3ec 100644 --- a/spec/ruby/library/digest/sha384/update_spec.rb +++ b/spec/ruby/library/digest/sha384/update_spec.rb @@ -1,7 +1,8 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require File.expand_path('../shared/constants', __FILE__) -require File.expand_path('../shared/update', __FILE__) +require_relative '../../../spec_helper' +require 'digest' describe "Digest::SHA384#update" do - it_behaves_like :sha384_update, :update + it "is an alias of Digest::SHA384#<<" do + Digest::SHA384.instance_method(:update).should == Digest::SHA384.instance_method(:<<) + end end |
