Permalink
Browse files

Handle absence of base64 library in 1.9.0

  • Loading branch information...
rmagick
rmagick committed Dec 27, 2007
1 parent 6f6f776 commit 7ff7768f017d43e23742d5b9aca8a466279f8cfb
Showing with 11 additions and 2 deletions.
  1. +11 −2 test/Image1.rb
View
@@ -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])

0 comments on commit 7ff7768

Please sign in to comment.