summaryrefslogtreecommitdiff
path: root/spec/ruby/library/digest/sha512
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/digest/sha512')
-rw-r--r--spec/ruby/library/digest/sha512/append_spec.rb7
-rw-r--r--spec/ruby/library/digest/sha512/file_spec.rb8
-rw-r--r--spec/ruby/library/digest/sha512/length_spec.rb8
-rw-r--r--spec/ruby/library/digest/sha512/shared/constants.rb2
-rw-r--r--spec/ruby/library/digest/sha512/shared/length.rb8
-rw-r--r--spec/ruby/library/digest/sha512/shared/update.rb7
-rw-r--r--spec/ruby/library/digest/sha512/size_spec.rb7
-rw-r--r--spec/ruby/library/digest/sha512/update_spec.rb7
8 files changed, 24 insertions, 30 deletions
diff --git a/spec/ruby/library/digest/sha512/append_spec.rb b/spec/ruby/library/digest/sha512/append_spec.rb
index e5f84b56f4..f297005403 100644
--- a/spec/ruby/library/digest/sha512/append_spec.rb
+++ b/spec/ruby/library/digest/sha512/append_spec.rb
@@ -1,7 +1,10 @@
require_relative '../../../spec_helper'
require_relative 'shared/constants'
-require_relative 'shared/update'
describe "Digest::SHA512#<<" do
- it_behaves_like :sha512_update, :<<
+ it "can update" do
+ cur_digest = Digest::SHA512.new
+ cur_digest << SHA512Constants::Contents
+ cur_digest.digest.should == SHA512Constants::Digest
+ end
end
diff --git a/spec/ruby/library/digest/sha512/file_spec.rb b/spec/ruby/library/digest/sha512/file_spec.rb
index 781ec781e5..78d6d3d4f3 100644
--- a/spec/ruby/library/digest/sha512/file_spec.rb
+++ b/spec/ruby/library/digest/sha512/file_spec.rb
@@ -15,7 +15,7 @@ describe "Digest::SHA512.file" do
end
it "returns a Digest::SHA512 object" do
- Digest::SHA512.file(@file).should be_kind_of(Digest::SHA512)
+ Digest::SHA512.file(@file).should.is_a?(Digest::SHA512)
end
it "returns a Digest::SHA512 object with the correct digest" do
@@ -26,7 +26,7 @@ describe "Digest::SHA512.file" do
obj = mock("to_str")
obj.should_receive(:to_str).and_return(@file)
result = Digest::SHA512.file(obj)
- result.should be_kind_of(Digest::SHA512)
+ result.should.is_a?(Digest::SHA512)
result.digest.should == SHA512Constants::Digest
end
end
@@ -34,10 +34,10 @@ describe "Digest::SHA512.file" do
it_behaves_like :file_read_directory, :file, Digest::SHA512
it "raises a Errno::ENOENT when passed a path that does not exist" do
- -> { Digest::SHA512.file("") }.should raise_error(Errno::ENOENT)
+ -> { Digest::SHA512.file("") }.should.raise(Errno::ENOENT)
end
it "raises a TypeError when passed nil" do
- -> { Digest::SHA512.file(nil) }.should raise_error(TypeError)
+ -> { Digest::SHA512.file(nil) }.should.raise(TypeError)
end
end
diff --git a/spec/ruby/library/digest/sha512/length_spec.rb b/spec/ruby/library/digest/sha512/length_spec.rb
index e9fde90577..8e909482c5 100644
--- a/spec/ruby/library/digest/sha512/length_spec.rb
+++ b/spec/ruby/library/digest/sha512/length_spec.rb
@@ -1,7 +1,11 @@
require_relative '../../../spec_helper'
require_relative 'shared/constants'
-require_relative 'shared/length'
describe "Digest::SHA512#length" do
- it_behaves_like :sha512_length, :length
+ it "returns the length of the digest" do
+ cur_digest = Digest::SHA512.new
+ cur_digest.length.should == SHA512Constants::BlankDigest.size
+ cur_digest << SHA512Constants::Contents
+ cur_digest.length.should == SHA512Constants::Digest.size
+ end
end
diff --git a/spec/ruby/library/digest/sha512/shared/constants.rb b/spec/ruby/library/digest/sha512/shared/constants.rb
index 2765a1ec16..91787381ee 100644
--- a/spec/ruby/library/digest/sha512/shared/constants.rb
+++ b/spec/ruby/library/digest/sha512/shared/constants.rb
@@ -1,4 +1,4 @@
-# -*- encoding: binary -*-
+# encoding: binary
require 'digest/sha2'
diff --git a/spec/ruby/library/digest/sha512/shared/length.rb b/spec/ruby/library/digest/sha512/shared/length.rb
deleted file mode 100644
index c0609d5386..0000000000
--- a/spec/ruby/library/digest/sha512/shared/length.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-describe :sha512_length, shared: true do
- it "returns the length of the digest" do
- cur_digest = Digest::SHA512.new
- cur_digest.send(@method).should == SHA512Constants::BlankDigest.size
- cur_digest << SHA512Constants::Contents
- cur_digest.send(@method).should == SHA512Constants::Digest.size
- end
-end
diff --git a/spec/ruby/library/digest/sha512/shared/update.rb b/spec/ruby/library/digest/sha512/shared/update.rb
deleted file mode 100644
index ca74dbf4df..0000000000
--- a/spec/ruby/library/digest/sha512/shared/update.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-describe :sha512_update, shared: true do
- it "can update" do
- cur_digest = Digest::SHA512.new
- cur_digest.send @method, SHA512Constants::Contents
- cur_digest.digest.should == SHA512Constants::Digest
- end
-end
diff --git a/spec/ruby/library/digest/sha512/size_spec.rb b/spec/ruby/library/digest/sha512/size_spec.rb
index 6d0acdabdb..498d686802 100644
--- a/spec/ruby/library/digest/sha512/size_spec.rb
+++ b/spec/ruby/library/digest/sha512/size_spec.rb
@@ -1,7 +1,8 @@
require_relative '../../../spec_helper'
-require_relative 'shared/constants'
-require_relative 'shared/length'
+require 'digest'
describe "Digest::SHA512#size" do
- it_behaves_like :sha512_length, :size
+ it "is an alias of Digest::SHA512#length" do
+ Digest::SHA512.instance_method(:size).should == Digest::SHA512.instance_method(:length)
+ end
end
diff --git a/spec/ruby/library/digest/sha512/update_spec.rb b/spec/ruby/library/digest/sha512/update_spec.rb
index 682d3a19bb..33edf216ac 100644
--- a/spec/ruby/library/digest/sha512/update_spec.rb
+++ b/spec/ruby/library/digest/sha512/update_spec.rb
@@ -1,7 +1,8 @@
require_relative '../../../spec_helper'
-require_relative 'shared/constants'
-require_relative 'shared/update'
+require 'digest'
describe "Digest::SHA512#update" do
- it_behaves_like :sha512_update, :update
+ it "is an alias of Digest::SHA512#<<" do
+ Digest::SHA512.instance_method(:update).should == Digest::SHA512.instance_method(:<<)
+ end
end