diff options
Diffstat (limited to 'spec/ruby/library/openssl/digest')
| -rw-r--r-- | spec/ruby/library/openssl/digest/initialize_spec.rb | 16 | ||||
| -rw-r--r-- | spec/ruby/library/openssl/digest/shared/update.rb | 8 |
2 files changed, 10 insertions, 14 deletions
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 |
