Sha256: e9abbfab2686a7044c4e90c44a7df16be5770b9cd74a5457c4d429cf635fc42a
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' describe Digest::StringBuffer do it "initialize" do expect(Digest::StringBuffer.new).to be_a_kind_of(Digest::StringBuffer) expect(Test.new).to be_a_kind_of(Digest::StringBuffer) end it "digest" do expect(Test.digest("abc" * 1000)).to eq("\x00\x8B\x11\x90".force_encoding("ASCII-8BIT")) end it "hexdigest" do expect(Test.hexdigest("abc" * 1000)).to eq("008b1190") end it "update and reset and hexdigest" do test = Test.new test.update("b").update("u").update("ff") test << "er" expect(test.hexdigest).to eq("00004cc6"); expect(test.hexdigest).to eq("00004cc6"); expect(test.hexdigest!).to eq("00004cc6"); expect(test.hexdigest).to eq("00000000"); end it "==" do test1 = Test.new.update("test") test2 = Test.new.update("test") expect(test1).to eq(test2) end it "dup" do test1 = Test.new.update("buff") test2 = test1.dup.update("er") expect(test2.hexdigest).to eq("00004cc6"); end it "length" do expect(Test.new.length).to eq(4); end it "buffer" do expect(Digest::StringBuffer.new.update("a").buffer).to eq("a") expect(Test.new.update("a").buffer).to eq("a") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
digest-stringbuffer-0.0.3 | spec/buffer_spec.rb |
digest-stringbuffer-0.0.2 | spec/buffer_spec.rb |
digest-stringbuffer-0.0.1 | spec/buffer_spec.rb |