spec/message_digest_spec.rb in r509-0.10.0 vs spec/message_digest_spec.rb in r509-1.0
- old
+ new
@@ -3,113 +3,113 @@
require 'openssl'
describe R509::MessageDigest do
it "translates sha1 name -> digest" do
md = R509::MessageDigest.new("sha1")
- md.name.should == "sha1"
- md.digest.kind_of?(OpenSSL::Digest::SHA1).should == true
+ expect(md.name).to eq("sha1")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA1)).to eq(true)
end
it "translates SHA1 name -> digest" do
md = R509::MessageDigest.new("SHA1")
- md.name.should == "sha1"
- md.digest.kind_of?(OpenSSL::Digest::SHA1).should == true
+ expect(md.name).to eq("sha1")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA1)).to eq(true)
end
it "translates sha224 name -> digest" do
md = R509::MessageDigest.new("sha224")
- md.name.should == "sha224"
- md.digest.kind_of?(OpenSSL::Digest::SHA224).should == true
+ expect(md.name).to eq("sha224")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA224)).to eq(true)
end
it "translates sha256 name -> digest" do
md = R509::MessageDigest.new("sha256")
- md.name.should == "sha256"
- md.digest.kind_of?(OpenSSL::Digest::SHA256).should == true
+ expect(md.name).to eq("sha256")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA256)).to eq(true)
end
it "translates SHA256 name -> digest" do
md = R509::MessageDigest.new("SHA256")
- md.name.should == "sha256"
- md.digest.kind_of?(OpenSSL::Digest::SHA256).should == true
+ expect(md.name).to eq("sha256")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA256)).to eq(true)
end
it "translates SHA384 name -> digest" do
md = R509::MessageDigest.new("SHA384")
- md.name.should == "sha384"
- md.digest.kind_of?(OpenSSL::Digest::SHA384).should == true
+ expect(md.name).to eq("sha384")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA384)).to eq(true)
end
it "translates sha512 name -> digest" do
md = R509::MessageDigest.new("sha512")
- md.name.should == "sha512"
- md.digest.kind_of?(OpenSSL::Digest::SHA512).should == true
+ expect(md.name).to eq("sha512")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA512)).to eq(true)
end
it "translates SHA512 name -> digest" do
md = R509::MessageDigest.new("SHA512")
- md.name.should == "sha512"
- md.digest.kind_of?(OpenSSL::Digest::SHA512).should == true
+ expect(md.name).to eq("sha512")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA512)).to eq(true)
end
it "translates md5 name -> digest" do
md = R509::MessageDigest.new("md5")
- md.name.should == "md5"
- md.digest.kind_of?(OpenSSL::Digest::MD5).should == true
+ expect(md.name).to eq("md5")
+ expect(md.digest.is_a?(OpenSSL::Digest::MD5)).to eq(true)
end
it "translates MD5 name -> digest" do
md = R509::MessageDigest.new("MD5")
- md.name.should == "md5"
- md.digest.kind_of?(OpenSSL::Digest::MD5).should == true
+ expect(md.name).to eq("md5")
+ expect(md.digest.is_a?(OpenSSL::Digest::MD5)).to eq(true)
end
it "translates dss1 name -> digest" do
md = R509::MessageDigest.new("dss1")
- md.name.should == "dss1"
- md.digest.kind_of?(OpenSSL::Digest::DSS1).should == true
+ expect(md.name).to eq("dss1")
+ expect(md.digest.is_a?(OpenSSL::Digest::DSS1)).to eq(true)
end
it "translates DSS1 name -> digest" do
md = R509::MessageDigest.new("DSS1")
- md.name.should == "dss1"
- md.digest.kind_of?(OpenSSL::Digest::DSS1).should == true
+ expect(md.name).to eq("dss1")
+ expect(md.digest.is_a?(OpenSSL::Digest::DSS1)).to eq(true)
end
it "translates unknown name -> digest" do
md = R509::MessageDigest.new("unknown")
- md.name.should == "sha1"
- md.digest.kind_of?(OpenSSL::Digest::SHA1).should == true
+ expect(md.name).to eq("sha256")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA256)).to eq(true)
end
it "translates sha1 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::SHA1.new)
- md.name.should == "sha1"
- md.digest.kind_of?(OpenSSL::Digest::SHA1).should == true
+ expect(md.name).to eq("sha1")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA1)).to eq(true)
end
it "translates sha224 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::SHA224.new)
- md.name.should == "sha224"
- md.digest.kind_of?(OpenSSL::Digest::SHA224).should == true
+ expect(md.name).to eq("sha224")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA224)).to eq(true)
end
it "translates sha256 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::SHA256.new)
- md.name.should == "sha256"
- md.digest.kind_of?(OpenSSL::Digest::SHA256).should == true
+ expect(md.name).to eq("sha256")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA256)).to eq(true)
end
it "translates sha384 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::SHA384.new)
- md.name.should == "sha384"
- md.digest.kind_of?(OpenSSL::Digest::SHA384).should == true
+ expect(md.name).to eq("sha384")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA384)).to eq(true)
end
it "translates sha512 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::SHA512.new)
- md.name.should == "sha512"
- md.digest.kind_of?(OpenSSL::Digest::SHA512).should == true
+ expect(md.name).to eq("sha512")
+ expect(md.digest.is_a?(OpenSSL::Digest::SHA512)).to eq(true)
end
it "translates md5 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::MD5.new)
- md.name.should == "md5"
- md.digest.kind_of?(OpenSSL::Digest::MD5).should == true
+ expect(md.name).to eq("md5")
+ expect(md.digest.is_a?(OpenSSL::Digest::MD5)).to eq(true)
end
it "translates dss1 digest -> name" do
md = R509::MessageDigest.new(OpenSSL::Digest::DSS1.new)
- md.name.should == "dss1"
- md.digest.kind_of?(OpenSSL::Digest::DSS1).should == true
+ expect(md.name).to eq("dss1")
+ expect(md.digest.is_a?(OpenSSL::Digest::DSS1)).to eq(true)
end
it "creates a default digest with no params or nil" do
md = R509::MessageDigest.new
- md.name.should == R509::MessageDigest::DEFAULT_MD.downcase
+ expect(md.name).to eq(R509::MessageDigest::DEFAULT_MD.downcase)
md = R509::MessageDigest.new(nil)
- md.name.should == R509::MessageDigest::DEFAULT_MD.downcase
+ expect(md.name).to eq(R509::MessageDigest::DEFAULT_MD.downcase)
end
it "exception on unknown digest -> name" do
- expect{ R509::MessageDigest.new(12345) }.to raise_error(ArgumentError)
+ expect { R509::MessageDigest.new(12345) }.to raise_error(ArgumentError)
end
end