Skip to content

Commit b4b37fb

Browse files
committed
Fix some encoding issues
1 parent f721e42 commit b4b37fb

File tree

11 files changed

+49
-29
lines changed

11 files changed

+49
-29
lines changed

lib/barby/barcode/bookland.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'barby/barcode/ean_13'
23

34
module Barby

lib/barby/barcode/code_128.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'barby/barcode'
23

34
module Barby

lib/barby/barcode/code_39.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'barby/barcode'
23

34
module Barby

lib/barby/barcode/code_93.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'barby/barcode'
23

34
module Barby

lib/barby/barcode/data_matrix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'semacode'
1+
require 'semacode' #Ruby 1.8: gem install semacode - Ruby 1.9: gem install semacode-ruby19
22
require 'barby/barcode'
33

44
module Barby

test/barcodes.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require 'code_128_test'
2+
require 'gs1_128_test'
3+
4+
require 'code_25_test'
5+
require 'code_25_interleaved_test'
6+
require 'code_25_iata_test'
7+
8+
require 'code_39_test'
9+
require 'code_93_test'
10+
11+
require 'ean13_test'
12+
require 'ean8_test'
13+
require 'bookland_test'
14+
require 'upc_supplemental_test'
15+
16+
require 'data_matrix_test'
17+
require 'qr_code_test'
18+
19+
#require 'pdf_417_test'

test/code_39_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'test_helper'
23
require 'barby/barcode/code_39'
34

test/code_93_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'test_helper'
23
require 'barby/barcode/code_93'
34

test/data_matrix_test.rb

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
unless RUBY_VERSION >= '1.9'
1+
require 'test_helper'
2+
require 'barby/barcode/data_matrix'
23

3-
require 'test_helper'
4-
require 'barby/barcode/data_matrix'
4+
class DataMatrixTest < Barby::TestCase
55

6-
class DataMatrixTest < Barby::TestCase
7-
8-
before do
9-
@data = "humbaba"
10-
@code = Barby::DataMatrix.new(@data)
11-
end
12-
13-
it "should have the expected encoding" do
14-
@code.encoding.must_equal ["1010101010101010", "1011111000011111", "1110111000010100",
15-
"1110100100000111", "1101111010101000", "1101111011110011",
16-
"1111111100000100", "1100101111110001", "1001000010001010",
17-
"1101010110111011", "1000000100011110", "1001010010000011",
18-
"1101100111011110", "1110111010000101", "1110010110001010",
19-
"1111111111111111"]
20-
end
6+
before do
7+
@data = "humbaba"
8+
@code = Barby::DataMatrix.new(@data)
9+
end
2110

22-
it "should return data on to_s" do
23-
@code.to_s.must_equal @data
24-
end
11+
it "should have the expected encoding" do
12+
@code.encoding.must_equal ["1010101010101010", "1011111000011111", "1110111000010100",
13+
"1110100100000111", "1101111010101000", "1101111011110011",
14+
"1111111100000100", "1100101111110001", "1001000010001010",
15+
"1101010110111011", "1000000100011110", "1001010010000011",
16+
"1101100111011110", "1110111010000101", "1110010110001010",
17+
"1111111111111111"]
18+
end
2519

26-
it "should be able to change its data" do
27-
prev_encoding = @code.encoding
28-
@code.data = "after eight"
29-
@code.encoding.wont_equal prev_encoding
30-
end
20+
it "should return data on to_s" do
21+
@code.to_s.must_equal @data
22+
end
3123

24+
it "should be able to change its data" do
25+
prev_encoding = @code.encoding
26+
@code.data = "after eight"
27+
@code.encoding.wont_equal prev_encoding
3228
end
3329

3430
end

test/gs1_128_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#encoding: ASCII
12
require 'test_helper'
23
require 'barby/barcode/gs1_128'
34

0 commit comments

Comments
 (0)