Skip to content

Commit

Permalink
Fix some encoding issues
Browse files Browse the repository at this point in the history
  • Loading branch information
toretore committed Mar 12, 2013
1 parent f721e42 commit b4b37fb
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 29 deletions.
1 change: 1 addition & 0 deletions lib/barby/barcode/bookland.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'barby/barcode/ean_13'

module Barby
Expand Down
1 change: 1 addition & 0 deletions lib/barby/barcode/code_128.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'barby/barcode'

module Barby
Expand Down
1 change: 1 addition & 0 deletions lib/barby/barcode/code_39.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'barby/barcode'

module Barby
Expand Down
1 change: 1 addition & 0 deletions lib/barby/barcode/code_93.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'barby/barcode'

module Barby
Expand Down
2 changes: 1 addition & 1 deletion lib/barby/barcode/data_matrix.rb
@@ -1,4 +1,4 @@
require 'semacode'
require 'semacode' #Ruby 1.8: gem install semacode - Ruby 1.9: gem install semacode-ruby19
require 'barby/barcode'

module Barby
Expand Down
19 changes: 19 additions & 0 deletions test/barcodes.rb
@@ -0,0 +1,19 @@
require 'code_128_test'
require 'gs1_128_test'

require 'code_25_test'
require 'code_25_interleaved_test'
require 'code_25_iata_test'

require 'code_39_test'
require 'code_93_test'

require 'ean13_test'
require 'ean8_test'
require 'bookland_test'
require 'upc_supplemental_test'

require 'data_matrix_test'
require 'qr_code_test'

#require 'pdf_417_test'
1 change: 1 addition & 0 deletions test/code_39_test.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'test_helper'
require 'barby/barcode/code_39'

Expand Down
1 change: 1 addition & 0 deletions test/code_93_test.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'test_helper'
require 'barby/barcode/code_93'

Expand Down
48 changes: 22 additions & 26 deletions test/data_matrix_test.rb
@@ -1,34 +1,30 @@
unless RUBY_VERSION >= '1.9'
require 'test_helper'
require 'barby/barcode/data_matrix'

require 'test_helper'
require 'barby/barcode/data_matrix'
class DataMatrixTest < Barby::TestCase

class DataMatrixTest < Barby::TestCase

before do
@data = "humbaba"
@code = Barby::DataMatrix.new(@data)
end

it "should have the expected encoding" do
@code.encoding.must_equal ["1010101010101010", "1011111000011111", "1110111000010100",
"1110100100000111", "1101111010101000", "1101111011110011",
"1111111100000100", "1100101111110001", "1001000010001010",
"1101010110111011", "1000000100011110", "1001010010000011",
"1101100111011110", "1110111010000101", "1110010110001010",
"1111111111111111"]
end
before do
@data = "humbaba"
@code = Barby::DataMatrix.new(@data)
end

it "should return data on to_s" do
@code.to_s.must_equal @data
end
it "should have the expected encoding" do
@code.encoding.must_equal ["1010101010101010", "1011111000011111", "1110111000010100",
"1110100100000111", "1101111010101000", "1101111011110011",
"1111111100000100", "1100101111110001", "1001000010001010",
"1101010110111011", "1000000100011110", "1001010010000011",
"1101100111011110", "1110111010000101", "1110010110001010",
"1111111111111111"]
end

it "should be able to change its data" do
prev_encoding = @code.encoding
@code.data = "after eight"
@code.encoding.wont_equal prev_encoding
end
it "should return data on to_s" do
@code.to_s.must_equal @data
end

it "should be able to change its data" do
prev_encoding = @code.encoding
@code.data = "after eight"
@code.encoding.wont_equal prev_encoding
end

end
1 change: 1 addition & 0 deletions test/gs1_128_test.rb
@@ -1,3 +1,4 @@
#encoding: ASCII
require 'test_helper'
require 'barby/barcode/gs1_128'

Expand Down
2 changes: 0 additions & 2 deletions test/test_helper.rb
@@ -1,6 +1,4 @@
require 'rubygems'
require 'bundler'
Bundler.setup
require 'barby'
require 'minitest/spec'
require 'minitest/autorun'
Expand Down

0 comments on commit b4b37fb

Please sign in to comment.