summaryrefslogtreecommitdiff
path: root/spec/ruby/library/openssl
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/openssl')
-rw-r--r--spec/ruby/library/openssl/cipher_spec.rb2
-rw-r--r--spec/ruby/library/openssl/digest/initialize_spec.rb16
-rw-r--r--spec/ruby/library/openssl/digest/shared/update.rb8
-rw-r--r--spec/ruby/library/openssl/fixed_length_secure_compare_spec.rb12
-rw-r--r--spec/ruby/library/openssl/kdf/pbkdf2_hmac_spec.rb42
-rw-r--r--spec/ruby/library/openssl/kdf/scrypt_spec.rb45
-rw-r--r--spec/ruby/library/openssl/random/shared/random_bytes.rb4
-rw-r--r--spec/ruby/library/openssl/secure_compare_spec.rb12
-rw-r--r--spec/ruby/library/openssl/shared/constants.rb2
-rw-r--r--spec/ruby/library/openssl/x509/name/parse_spec.rb4
10 files changed, 69 insertions, 78 deletions
diff --git a/spec/ruby/library/openssl/cipher_spec.rb b/spec/ruby/library/openssl/cipher_spec.rb
index f66f25f9c6..91da1c592c 100644
--- a/spec/ruby/library/openssl/cipher_spec.rb
+++ b/spec/ruby/library/openssl/cipher_spec.rb
@@ -4,6 +4,6 @@ require 'openssl'
describe "OpenSSL::Cipher's CipherError" do
it "exists under OpenSSL::Cipher namespace" do
- OpenSSL::Cipher.should have_constant :CipherError
+ OpenSSL::Cipher.should.const_defined?(:CipherError, false)
end
end
diff --git a/spec/ruby/library/openssl/digest/initialize_spec.rb b/spec/ruby/library/openssl/digest/initialize_spec.rb
index 1cd0409c4d..e24ab51d14 100644
--- a/spec/ruby/library/openssl/digest/initialize_spec.rb
+++ b/spec/ruby/library/openssl/digest/initialize_spec.rb
@@ -23,18 +23,14 @@ describe "OpenSSL::Digest#initialize" do
OpenSSL::Digest.new("sha512").name.should == "SHA512"
end
- it "throws an error when called with an unknown digest" do
- -> { OpenSSL::Digest.new("wd40") }.should raise_error(RuntimeError, /Unsupported digest algorithm \(wd40\)/)
+ version_is OpenSSL::VERSION, "4.0.0" do
+ it "throws an error when called with an unknown digest" do
+ -> { OpenSSL::Digest.new("wd40") }.should.raise(OpenSSL::Digest::DigestError, /wd40/)
+ end
end
it "cannot be called with a symbol" do
- -> { OpenSSL::Digest.new(:SHA1) }.should raise_error(TypeError, /wrong argument type Symbol/)
- end
-
- it "does not call #to_str on the argument" do
- name = mock("digest name")
- name.should_not_receive(:to_str)
- -> { OpenSSL::Digest.new(name) }.should raise_error(TypeError, /wrong argument type/)
+ -> { OpenSSL::Digest.new(:SHA1) }.should.raise(TypeError)
end
end
@@ -62,7 +58,7 @@ describe "OpenSSL::Digest#initialize" do
end
it "cannot be called with a digest class" do
- -> { OpenSSL::Digest.new(OpenSSL::Digest::SHA1) }.should raise_error(TypeError, /wrong argument type Class/)
+ -> { OpenSSL::Digest.new(OpenSSL::Digest::SHA1) }.should.raise(TypeError)
end
context "when called without an initial String argument" do
diff --git a/spec/ruby/library/openssl/digest/shared/update.rb b/spec/ruby/library/openssl/digest/shared/update.rb
index e5ff9dcb16..37277c945d 100644
--- a/spec/ruby/library/openssl/digest/shared/update.rb
+++ b/spec/ruby/library/openssl/digest/shared/update.rb
@@ -96,28 +96,28 @@ describe :openssl_digest_update, shared: true do
digest = OpenSSL::Digest.new('sha1')
-> {
digest.send(@method, Object.new)
- }.should raise_error(TypeError, 'no implicit conversion of Object into String')
+ }.should.raise(TypeError, 'no implicit conversion of Object into String')
end
it "raises a TypeError with SHA256" do
digest = OpenSSL::Digest.new('sha256')
-> {
digest.send(@method, Object.new)
- }.should raise_error(TypeError, 'no implicit conversion of Object into String')
+ }.should.raise(TypeError, 'no implicit conversion of Object into String')
end
it "raises a TypeError with SHA384" do
digest = OpenSSL::Digest.new('sha384')
-> {
digest.send(@method, Object.new)
- }.should raise_error(TypeError, 'no implicit conversion of Object into String')
+ }.should.raise(TypeError, 'no implicit conversion of Object into String')
end
it "raises a TypeError with SHA512" do
digest = OpenSSL::Digest.new('sha512')
-> {
digest.send(@method, Object.new)
- }.should raise_error(TypeError, 'no implicit conversion of Object into String')
+ }.should.raise(TypeError, 'no implicit conversion of Object into String')
end
end
end
diff --git a/spec/ruby/library/openssl/fixed_length_secure_compare_spec.rb b/spec/ruby/library/openssl/fixed_length_secure_compare_spec.rb
index 5a2ca168b5..cc638e1f0d 100644
--- a/spec/ruby/library/openssl/fixed_length_secure_compare_spec.rb
+++ b/spec/ruby/library/openssl/fixed_length_secure_compare_spec.rb
@@ -5,13 +5,13 @@ describe "OpenSSL.fixed_length_secure_compare" do
it "returns true for two strings with the same content" do
input1 = "the quick brown fox jumps over the lazy dog"
input2 = "the quick brown fox jumps over the lazy dog"
- OpenSSL.fixed_length_secure_compare(input1, input2).should be_true
+ OpenSSL.fixed_length_secure_compare(input1, input2).should == true
end
it "returns false for two strings of equal size with different content" do
input1 = "the quick brown fox jumps over the lazy dog"
input2 = "the lazy dog jumps over the quick brown fox"
- OpenSSL.fixed_length_secure_compare(input1, input2).should be_false
+ OpenSSL.fixed_length_secure_compare(input1, input2).should == false
end
it "converts both arguments to strings using #to_str" do
@@ -19,17 +19,17 @@ describe "OpenSSL.fixed_length_secure_compare" do
input1.should_receive(:to_str).and_return("the quick brown fox jumps over the lazy dog")
input2 = mock("input2")
input2.should_receive(:to_str).and_return("the quick brown fox jumps over the lazy dog")
- OpenSSL.fixed_length_secure_compare(input1, input2).should be_true
+ OpenSSL.fixed_length_secure_compare(input1, input2).should == true
end
it "does not accept arguments that are not string and cannot be coerced into strings" do
-> {
OpenSSL.fixed_length_secure_compare("input1", :input2)
- }.should raise_error(TypeError, 'no implicit conversion of Symbol into String')
+ }.should.raise(TypeError, 'no implicit conversion of Symbol into String')
-> {
OpenSSL.fixed_length_secure_compare(Object.new, "input2")
- }.should raise_error(TypeError, 'no implicit conversion of Object into String')
+ }.should.raise(TypeError, 'no implicit conversion of Object into String')
end
it "raises an ArgumentError for two strings of different size" do
@@ -37,6 +37,6 @@ describe "OpenSSL.fixed_length_secure_compare" do
input2 = "the quick brown fox"
-> {
OpenSSL.fixed_length_secure_compare(input1, input2)
- }.should raise_error(ArgumentError, 'inputs must be of equal length')
+ }.should.raise(ArgumentError, 'inputs must be of equal length')
end
end
diff --git a/spec/ruby/library/openssl/kdf/pbkdf2_hmac_spec.rb b/spec/ruby/library/openssl/kdf/pbkdf2_hmac_spec.rb
index 40f8597275..2558dbb9ec 100644
--- a/spec/ruby/library/openssl/kdf/pbkdf2_hmac_spec.rb
+++ b/spec/ruby/library/openssl/kdf/pbkdf2_hmac_spec.rb
@@ -83,86 +83,80 @@ describe "OpenSSL::KDF.pbkdf2_hmac" do
it "raises a TypeError when password is not a String and does not respond to #to_str" do
-> {
OpenSSL::KDF.pbkdf2_hmac(Object.new, **@defaults)
- }.should raise_error(TypeError, "no implicit conversion of Object into String")
+ }.should.raise(TypeError, "no implicit conversion of Object into String")
end
it "raises a TypeError when salt is not a String and does not respond to #to_str" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, salt: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into String")
+ }.should.raise(TypeError, "no implicit conversion of Object into String")
end
it "raises a TypeError when iterations is not an Integer and does not respond to #to_int" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, iterations: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into Integer")
+ }.should.raise(TypeError, "no implicit conversion of Object into Integer")
end
it "raises a TypeError when length is not an Integer and does not respond to #to_int" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, length: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into Integer")
+ }.should.raise(TypeError, "no implicit conversion of Object into Integer")
end
it "raises a TypeError when hash is neither a String nor an OpenSSL::Digest" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, hash: Object.new)
- }.should raise_error(TypeError, "wrong argument type Object (expected OpenSSL/Digest)")
+ }.should.raise(TypeError)
end
- it "raises a TypeError when hash is neither a String nor an OpenSSL::Digest, it does not try to call #to_str" do
- hash = mock("hash")
- hash.should_not_receive(:to_str)
- -> {
- OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, hash: hash)
- }.should raise_error(TypeError, "wrong argument type MockObject (expected OpenSSL/Digest)")
- end
-
- it "raises a RuntimeError for unknown digest algorithms" do
- -> {
- OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, hash: "wd40")
- }.should raise_error(RuntimeError, /Unsupported digest algorithm \(wd40\)/)
+ version_is OpenSSL::VERSION, "4.0.0" do
+ it "raises a OpenSSL::Digest::DigestError for unknown digest algorithms" do
+ -> {
+ OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, hash: "wd40")
+ }.should.raise(OpenSSL::Digest::DigestError, /wd40/)
+ end
end
it "treats salt as a required keyword" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults.except(:salt))
- }.should raise_error(ArgumentError, 'missing keyword: :salt')
+ }.should.raise(ArgumentError, 'missing keyword: :salt')
end
it "treats iterations as a required keyword" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults.except(:iterations))
- }.should raise_error(ArgumentError, 'missing keyword: :iterations')
+ }.should.raise(ArgumentError, 'missing keyword: :iterations')
end
it "treats length as a required keyword" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults.except(:length))
- }.should raise_error(ArgumentError, 'missing keyword: :length')
+ }.should.raise(ArgumentError, 'missing keyword: :length')
end
it "treats hash as a required keyword" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults.except(:hash))
- }.should raise_error(ArgumentError, 'missing keyword: :hash')
+ }.should.raise(ArgumentError, 'missing keyword: :hash')
end
it "treats all keywords as required" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret")
- }.should raise_error(ArgumentError, 'missing keywords: :salt, :iterations, :length, :hash')
+ }.should.raise(ArgumentError, 'missing keywords: :salt, :iterations, :length, :hash')
end
guard -> { OpenSSL::OPENSSL_VERSION_NUMBER >= 0x30000000 } do
it "raises an OpenSSL::KDF::KDFError for 0 or less iterations" do
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, iterations: 0)
- }.should raise_error(OpenSSL::KDF::KDFError, "PKCS5_PBKDF2_HMAC: invalid iteration count")
+ }.should.raise(OpenSSL::KDF::KDFError, "PKCS5_PBKDF2_HMAC: invalid iteration count")
-> {
OpenSSL::KDF.pbkdf2_hmac("secret", **@defaults, iterations: -1)
- }.should raise_error(OpenSSL::KDF::KDFError, /PKCS5_PBKDF2_HMAC/)
+ }.should.raise(OpenSSL::KDF::KDFError, /PKCS5_PBKDF2_HMAC/)
end
end
end
diff --git a/spec/ruby/library/openssl/kdf/scrypt_spec.rb b/spec/ruby/library/openssl/kdf/scrypt_spec.rb
index 5dc9f2f281..c00f91bb5b 100644
--- a/spec/ruby/library/openssl/kdf/scrypt_spec.rb
+++ b/spec/ruby/library/openssl/kdf/scrypt_spec.rb
@@ -1,7 +1,8 @@
require_relative '../../../spec_helper'
require 'openssl'
-guard -> { OpenSSL::KDF.respond_to?(:scrypt) } do
+# LibreSSL seems not to support scrypt
+guard -> { OpenSSL::OPENSSL_VERSION.start_with?('OpenSSL') and OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10100000 } do
describe "OpenSSL::KDF.scrypt" do
before :each do
@defaults = {
@@ -88,79 +89,79 @@ guard -> { OpenSSL::KDF.respond_to?(:scrypt) } do
it "raises a TypeError when password is not a String and does not respond to #to_str" do
-> {
OpenSSL::KDF.scrypt(Object.new, **@defaults)
- }.should raise_error(TypeError, "no implicit conversion of Object into String")
+ }.should.raise(TypeError, "no implicit conversion of Object into String")
end
it "raises a TypeError when salt is not a String and does not respond to #to_str" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, salt: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into String")
+ }.should.raise(TypeError, "no implicit conversion of Object into String")
end
it "raises a TypeError when N is not an Integer and does not respond to #to_int" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, N: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into Integer")
+ }.should.raise(TypeError, "no implicit conversion of Object into Integer")
end
it "raises a TypeError when r is not an Integer and does not respond to #to_int" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, r: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into Integer")
+ }.should.raise(TypeError, "no implicit conversion of Object into Integer")
end
it "raises a TypeError when p is not an Integer and does not respond to #to_int" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, p: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into Integer")
+ }.should.raise(TypeError, "no implicit conversion of Object into Integer")
end
it "raises a TypeError when length is not an Integer and does not respond to #to_int" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, length: Object.new)
- }.should raise_error(TypeError, "no implicit conversion of Object into Integer")
+ }.should.raise(TypeError, "no implicit conversion of Object into Integer")
end
it "treats salt as a required keyword" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults.except(:salt))
- }.should raise_error(ArgumentError, 'missing keyword: :salt')
+ }.should.raise(ArgumentError, 'missing keyword: :salt')
end
it "treats N as a required keyword" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults.except(:N))
- }.should raise_error(ArgumentError, 'missing keyword: :N')
+ }.should.raise(ArgumentError, 'missing keyword: :N')
end
it "treats r as a required keyword" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults.except(:r))
- }.should raise_error(ArgumentError, 'missing keyword: :r')
+ }.should.raise(ArgumentError, 'missing keyword: :r')
end
it "treats p as a required keyword" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults.except(:p))
- }.should raise_error(ArgumentError, 'missing keyword: :p')
+ }.should.raise(ArgumentError, 'missing keyword: :p')
end
it "treats length as a required keyword" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults.except(:length))
- }.should raise_error(ArgumentError, 'missing keyword: :length')
+ }.should.raise(ArgumentError, 'missing keyword: :length')
end
it "treats all keywords as required" do
-> {
OpenSSL::KDF.scrypt("secret")
- }.should raise_error(ArgumentError, 'missing keywords: :salt, :N, :r, :p, :length')
+ }.should.raise(ArgumentError, 'missing keywords: :salt, :N, :r, :p, :length')
end
it "requires N to be a power of 2" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, N: 2**14 - 1)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
end
it "requires N to be at least 2" do
@@ -169,41 +170,41 @@ guard -> { OpenSSL::KDF.respond_to?(:scrypt) } do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, N: 1)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, N: 0)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, N: -1)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
end
it "requires r to be positive" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, r: 0)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, r: -1)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
end
it "requires p to be positive" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, p: 0)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, p: -1)
- }.should raise_error(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
+ }.should.raise(OpenSSL::KDF::KDFError, /EVP_PBE_scrypt/)
end
it "requires length to be not negative" do
-> {
OpenSSL::KDF.scrypt("secret", **@defaults, length: -1)
- }.should raise_error(ArgumentError, "negative string size (or size too big)")
+ }.should.raise(ArgumentError, "negative string size (or size too big)")
end
end
end
diff --git a/spec/ruby/library/openssl/random/shared/random_bytes.rb b/spec/ruby/library/openssl/random/shared/random_bytes.rb
index f97ccd9974..4d1751e57e 100644
--- a/spec/ruby/library/openssl/random/shared/random_bytes.rb
+++ b/spec/ruby/library/openssl/random/shared/random_bytes.rb
@@ -5,7 +5,7 @@ describe :openssl_random_bytes, shared: true do
it "generates a random binary string of specified length" do
(1..64).each do |idx|
bytes = OpenSSL::Random.send(@method, idx)
- bytes.should be_kind_of(String)
+ bytes.should.is_a?(String)
bytes.length.should == idx
end
end
@@ -24,6 +24,6 @@ describe :openssl_random_bytes, shared: true do
it "raises ArgumentError on negative arguments" do
-> {
OpenSSL::Random.send(@method, -1)
- }.should raise_error(ArgumentError)
+ }.should.raise(ArgumentError)
end
end
diff --git a/spec/ruby/library/openssl/secure_compare_spec.rb b/spec/ruby/library/openssl/secure_compare_spec.rb
index cec48e01e7..ce2a4a0d43 100644
--- a/spec/ruby/library/openssl/secure_compare_spec.rb
+++ b/spec/ruby/library/openssl/secure_compare_spec.rb
@@ -5,13 +5,13 @@ describe "OpenSSL.secure_compare" do
it "returns true for two strings with the same content" do
input1 = "the quick brown fox jumps over the lazy dog"
input2 = "the quick brown fox jumps over the lazy dog"
- OpenSSL.secure_compare(input1, input2).should be_true
+ OpenSSL.secure_compare(input1, input2).should == true
end
it "returns false for two strings with different content" do
input1 = "the quick brown fox jumps over the lazy dog"
input2 = "the lazy dog jumps over the quick brown fox"
- OpenSSL.secure_compare(input1, input2).should be_false
+ OpenSSL.secure_compare(input1, input2).should == false
end
it "converts both arguments to strings using #to_str, but adds equality check for the original objects" do
@@ -19,20 +19,20 @@ describe "OpenSSL.secure_compare" do
input1.should_receive(:to_str).and_return("the quick brown fox jumps over the lazy dog")
input2 = mock("input2")
input2.should_receive(:to_str).and_return("the quick brown fox jumps over the lazy dog")
- OpenSSL.secure_compare(input1, input2).should be_false
+ OpenSSL.secure_compare(input1, input2).should == false
input = mock("input")
input.should_receive(:to_str).twice.and_return("the quick brown fox jumps over the lazy dog")
- OpenSSL.secure_compare(input, input).should be_true
+ OpenSSL.secure_compare(input, input).should == true
end
it "does not accept arguments that are not string and cannot be coerced into strings" do
-> {
OpenSSL.secure_compare("input1", :input2)
- }.should raise_error(TypeError, 'no implicit conversion of Symbol into String')
+ }.should.raise(TypeError, 'no implicit conversion of Symbol into String')
-> {
OpenSSL.secure_compare(Object.new, "input2")
- }.should raise_error(TypeError, 'no implicit conversion of Object into String')
+ }.should.raise(TypeError, 'no implicit conversion of Object into String')
end
end
diff --git a/spec/ruby/library/openssl/shared/constants.rb b/spec/ruby/library/openssl/shared/constants.rb
index 0bed4156a1..836f75011b 100644
--- a/spec/ruby/library/openssl/shared/constants.rb
+++ b/spec/ruby/library/openssl/shared/constants.rb
@@ -1,4 +1,4 @@
-# -*- encoding: binary -*-
+# encoding: binary
module HMACConstants
Contents = "Ipsum is simply dummy text of the printing and typesetting industry. \nLorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \nIt has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. \nIt was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
diff --git a/spec/ruby/library/openssl/x509/name/parse_spec.rb b/spec/ruby/library/openssl/x509/name/parse_spec.rb
index 6624161d83..84e3d442f6 100644
--- a/spec/ruby/library/openssl/x509/name/parse_spec.rb
+++ b/spec/ruby/library/openssl/x509/name/parse_spec.rb
@@ -37,12 +37,12 @@ describe "OpenSSL::X509::Name.parse" do
it "raises TypeError if the given string contains no key/value pairs" do
-> do
OpenSSL::X509::Name.parse("hello")
- end.should raise_error(TypeError)
+ end.should.raise(TypeError)
end
it "raises OpenSSL::X509::NameError if the given string contains invalid keys" do
-> do
OpenSSL::X509::Name.parse("hello=goodbye")
- end.should raise_error(OpenSSL::X509::NameError)
+ end.should.raise(OpenSSL::X509::NameError)
end
end