summaryrefslogtreecommitdiff
path: root/spec/ruby/library/digest/instance
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/digest/instance')
-rw-r--r--spec/ruby/library/digest/instance/new_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/ruby/library/digest/instance/new_spec.rb b/spec/ruby/library/digest/instance/new_spec.rb
new file mode 100644
index 0000000000..3f7939844b
--- /dev/null
+++ b/spec/ruby/library/digest/instance/new_spec.rb
@@ -0,0 +1,19 @@
+require_relative '../../../spec_helper'
+require 'digest'
+require_relative '../md5/shared/constants'
+
+describe "Digest::Instance#new" do
+ it "returns a copy of the digest instance" do
+ digest = Digest::MD5.new
+ copy = digest.new
+ copy.should_not.equal?(digest)
+ end
+
+ it "calls reset" do
+ digest = Digest::MD5.new
+ digest << "test"
+ digest.hexdigest.should != MD5Constants::BlankHexdigest
+ copy = digest.new
+ copy.hexdigest.should == MD5Constants::BlankHexdigest
+ end
+end