summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/digest/md5/to_s_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/library/digest/md5/to_s_spec.rb')
-rw-r--r--spec/rubyspec/library/digest/md5/to_s_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/rubyspec/library/digest/md5/to_s_spec.rb b/spec/rubyspec/library/digest/md5/to_s_spec.rb
new file mode 100644
index 0000000000..59c17ec821
--- /dev/null
+++ b/spec/rubyspec/library/digest/md5/to_s_spec.rb
@@ -0,0 +1,24 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+require 'digest/md5'
+
+require File.expand_path('../shared/constants', __FILE__)
+
+describe "Digest::MD5#to_s" do
+
+ it "returns a hexdigest" do
+ cur_digest = Digest::MD5.new
+ cur_digest.to_s.should == MD5Constants::BlankHexdigest
+ end
+
+ it "does not change the internal state" do
+ cur_digest = Digest::MD5.new
+ cur_digest.to_s.should == MD5Constants::BlankHexdigest
+ cur_digest.to_s.should == MD5Constants::BlankHexdigest
+
+ cur_digest << MD5Constants::Contents
+ cur_digest.to_s.should == MD5Constants::Hexdigest
+ cur_digest.to_s.should == MD5Constants::Hexdigest
+ end
+
+end