1 #!/usr/bin/env jruby --headless -rubygems
3 require File.expand_path( File.dirname(__FILE__) + '/../test_helper')
4 require 'zxing/decodable'
6 class DecodableTest < Test::Unit::TestCase
20 context "A Decodable module" do
22 @file = File.open( File.expand_path( File.dirname(__FILE__) + '/../qrcode.png' ))
23 @uri = URL.new "http://2d-code.co.uk/images/bbc-logo-in-qr-code.gif"
24 @bad_uri = URL.new "http://google.com"
27 should "provide #decode to decode the return value of #path" do
28 assert_equal @file.decode, ZXing.decode(@file.path)
29 assert_equal @uri.decode, ZXing.decode(@uri.path)
30 assert_nil @bad_uri.decode
33 should "provide #decode! as well" do
34 assert_equal @file.decode!, ZXing.decode(@file.path)
35 assert_equal @uri.decode!, ZXing.decode(@uri.path)
36 assert_raise(NativeException) { @bad_uri.decode! }