Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle absence of base64 library in 1.9.0

  • Loading branch information...
commit 7ff7768f017d43e23742d5b9aca8a466279f8cfb 1 parent 6f6f776
rmagick authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 test/Image1.rb
View
13 test/Image1.rb
@@ -1,7 +1,12 @@
#! /usr/local/bin/ruby -w
require 'RMagick'
-require 'base64'
+begin
+ require 'base64'
+ $base_64 = true
+rescue LoadError
+ $base_64 = false
+end
require 'test/unit'
require 'test/unit/ui/console/testrunner'
@@ -95,7 +100,11 @@ def test_ping
def test_read_inline
img = Magick::Image.read(IMAGES_DIR+'/Button_0.gif').first
blob = img.to_blob
- encoded = Base64.encode64(blob)
+ if $base_64
+ encoded = Base64.encode64(blob)
+ else
+ encoded = blob.pack("m*")
+ end
res = Magick::Image.read_inline(encoded)
assert_instance_of(Array, res)
assert_instance_of(Magick::Image, res[0])
Please sign in to comment.
Something went wrong with that request. Please try again.