barby 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,8 +16,9 @@ class SvgBarcode < Barby::Barcode
16
16
  end
17
17
  end
18
18
 
19
+
19
20
  class SvgOutputterTest < Barby::TestCase
20
-
21
+
21
22
  before do
22
23
  load_outputter('svg')
23
24
  @barcode = SvgBarcode.new('10110011100011110000')
@@ -25,65 +26,65 @@ class SvgOutputterTest < Barby::TestCase
25
26
  end
26
27
 
27
28
  it 'should register to_svg, bars_to_rects, and bars_to_path' do
28
- Barcode.outputters.must_include :to_svg
29
- Barcode.outputters.must_include :bars_to_rects
30
- Barcode.outputters.must_include :bars_to_path
29
+ assert Barcode.outputters.include?(:to_svg)
30
+ assert Barcode.outputters.include?(:bars_to_rects)
31
+ assert Barcode.outputters.include?(:bars_to_path)
31
32
  end
32
33
 
33
34
  it 'should return a string on to_svg' do
34
- @barcode.to_svg.must_be_instance_of String
35
+ assert @barcode.to_svg.is_a?(String)
35
36
  end
36
-
37
+
37
38
  it 'should return a string on bars_to_rects' do
38
- @barcode.bars_to_rects.must_be_instance_of String
39
+ assert @barcode.bars_to_rects.is_a?(String)
39
40
  end
40
-
41
+
41
42
  it 'should return a string on bars_to_path' do
42
- @barcode.bars_to_path.must_be_instance_of String
43
+ assert @barcode.bars_to_path.is_a?(String)
43
44
  end
44
-
45
+
45
46
  it 'should produce one rect for each bar' do
46
- @barcode.bars_to_rects.scan(/<rect/).size.must_equal @outputter.send(:boolean_groups).select{|bg|bg[0]}.size
47
+ assert_equal @outputter.send(:boolean_groups).select{|bg|bg[0]}.size, @barcode.bars_to_rects.scan(/<rect/).size
47
48
  end
48
-
49
+
49
50
  it 'should produce one path stroke for each bar module' do
50
- @barcode.bars_to_path.scan(/(M\d+\s+\d+)\s*(V\d+)/).size.must_equal @outputter.send(:booleans).select{|bg|bg}.size
51
+ assert_equal @outputter.send(:booleans).select{|bg|bg}.size, @barcode.bars_to_path.scan(/(M\d+\s+\d+)\s*(V\d+)/).size
51
52
  end
52
-
53
+
53
54
  it 'should return default values for attributes' do
54
- @outputter.margin.must_be_instance_of Fixnum
55
+ assert @outputter.margin.is_a?(Integer)
55
56
  end
56
-
57
+
57
58
  it 'should use defaults to populate higher level attributes' do
58
- @outputter.xmargin.must_equal @outputter.margin
59
+ assert_equal @outputter.margin, @outputter.xmargin
59
60
  end
60
-
61
+
61
62
  it 'should return nil for overridden attributes' do
62
63
  @outputter.xmargin = 1
63
- @outputter.margin.must_equal nil
64
+ assert_equal nil, @outputter.margin
64
65
  end
65
-
66
+
66
67
  it 'should still use defaults for unspecified attributes' do
67
68
  @outputter.xmargin = 1
68
- @outputter.ymargin.must_equal @outputter.send(:_margin)
69
+ assert_equal @outputter.send(:_margin), @outputter.ymargin
69
70
  end
70
-
71
+
71
72
  it 'should have a width equal to Xdim * barcode_string.length' do
72
- @outputter.width.must_equal @outputter.barcode.encoding.length * @outputter.xdim
73
+ assert_equal @outputter.barcode.encoding.length * @outputter.xdim, @outputter.width
73
74
  end
74
-
75
+
75
76
  it 'should have a full_width which is by default the sum of width + (margin*2)' do
76
- @outputter.full_width.must_equal @outputter.width + (@outputter.margin*2)
77
+ assert_equal(@outputter.width + (@outputter.margin*2), @outputter.full_width)
77
78
  end
78
-
79
+
79
80
  it 'should have a full_width which is the sum of width + xmargin + ymargin' do
80
- @outputter.full_width.must_equal @outputter.width + @outputter.xmargin + @outputter.ymargin
81
+ assert_equal @outputter.width + @outputter.xmargin + @outputter.ymargin, @outputter.full_width
81
82
  end
82
-
83
+
83
84
  it 'should use Barcode#to_s for title' do
84
- @outputter.title.must_equal @barcode.data
85
+ assert_equal @barcode.data, @outputter.title
85
86
  def @barcode.to_s; "the eastern star"; end
86
- @outputter.title.must_equal "the eastern star"
87
+ assert_equal "the eastern star", @outputter.title
87
88
  end
88
-
89
+
89
90
  end
@@ -15,7 +15,7 @@ class OutputterTest < Barby::TestCase
15
15
  @outputter.register :quux => :my_quux
16
16
  Barcode.outputters.must_include(:quux)
17
17
  end
18
-
18
+
19
19
  describe "Outputter instances" do
20
20
 
21
21
  before do
@@ -26,56 +26,56 @@ class OutputterTest < Barby::TestCase
26
26
  end
27
27
 
28
28
  it "should have a method 'booleans' which converts the barcode encoding to an array of true,false values" do
29
- @outputter.send(:booleans).length.must_equal @barcode.encoding.length
29
+ assert_equal @barcode.encoding.length, @outputter.send(:booleans).length
30
30
  t, f = true, false
31
- @outputter.send(:booleans).must_equal [t,f,t,t,f,f,t,t,t,f,f,f]
31
+ assert_equal [t,f,t,t,f,f,t,t,t,f,f,f], @outputter.send(:booleans)
32
32
  end
33
33
 
34
34
  it "should convert 2D encodings with 'booleans'" do
35
35
  barcode = Barcode2D.new
36
36
  def barcode.encoding; ['101100','110010']; end
37
37
  outputter = Outputter.new(barcode)
38
- outputter.send(:booleans).length.must_equal barcode.encoding.length
38
+ assert_equal barcode.encoding.length, outputter.send(:booleans).length
39
39
  t, f = true, false
40
- outputter.send(:booleans).must_equal [[t,f,t,t,f,f], [t,t,f,f,t,f]]
40
+ assert_equal [[t,f,t,t,f,f], [t,t,f,f,t,f]], outputter.send(:booleans)
41
41
  end
42
42
 
43
43
  it "should have an 'encoding' attribute" do
44
- @outputter.send(:encoding).must_equal @barcode.encoding
44
+ assert_equal @barcode.encoding, @outputter.send(:encoding)
45
45
  end
46
46
 
47
47
  it "should cache encoding" do
48
- @outputter.send(:encoding).must_equal @barcode.encoding
48
+ assert_equal @barcode.encoding, @outputter.send(:encoding)
49
49
  previous_encoding = @barcode.encoding
50
50
  @barcode.encoding = '101010'
51
- @outputter.send(:encoding).must_equal previous_encoding
52
- @outputter.send(:encoding, true).must_equal @barcode.encoding
51
+ assert_equal previous_encoding, @outputter.send(:encoding)
52
+ assert_equal @barcode.encoding, @outputter.send(:encoding, true)
53
53
  end
54
54
 
55
55
  it "should have a boolean_groups attribute which collects continuous bars and spaces" do
56
56
  t, f = true, false
57
57
  # 1 0 11 00 111 000
58
- @outputter.send(:boolean_groups).must_equal [[t,1],[f,1],[t,2],[f,2],[t,3],[f,3]]
58
+ assert_equal [[t,1],[f,1],[t,2],[f,2],[t,3],[f,3]], @outputter.send(:boolean_groups)
59
59
 
60
60
  barcode = Barcode2D.new
61
61
  def barcode.encoding; ['1100', '111000']; end
62
62
  outputter = Outputter.new(barcode)
63
- outputter.send(:boolean_groups).must_equal [[[t,2],[f,2]],[[t,3],[f,3]]]
63
+ assert_equal [[[t,2],[f,2]],[[t,3],[f,3]]], outputter.send(:boolean_groups)
64
64
  end
65
65
 
66
66
  it "should have a with_options method which sets the instance's attributes temporarily while the block gets yielded" do
67
67
  class << @outputter; attr_accessor :foo, :bar; end
68
68
  @outputter.foo, @outputter.bar = 'humbaba', 'scorpion man'
69
69
  @outputter.send(:with_options, :foo => 'horse', :bar => 'donkey') do
70
- @outputter.foo.must_equal 'horse'
71
- @outputter.bar.must_equal 'donkey'
70
+ assert_equal 'horse', @outputter.foo
71
+ assert_equal 'donkey', @outputter.bar
72
72
  end
73
- @outputter.foo.must_equal 'humbaba'
74
- @outputter.bar.must_equal 'scorpion man'
73
+ assert_equal 'humbaba', @outputter.foo
74
+ assert_equal 'scorpion man', @outputter.bar
75
75
  end
76
76
 
77
77
  it "should return the block value on with_options" do
78
- @outputter.send(:with_options, {}){ 'donkey' }.must_equal 'donkey'
78
+ assert_equal 'donkey', @outputter.send(:with_options, {}){ 'donkey' }
79
79
  end
80
80
 
81
81
  it "should have a two_dimensional? method which returns true if the barcode is 2d" do
@@ -94,7 +94,7 @@ class OutputterTest < Barby::TestCase
94
94
  end
95
95
 
96
96
  describe "Barcode instances" do
97
-
97
+
98
98
  before do
99
99
  @outputter = Class.new(Outputter)
100
100
  @outputter.register :foo
@@ -102,33 +102,31 @@ class OutputterTest < Barby::TestCase
102
102
  @outputter.class_eval{ def foo; 'foo'; end; def my_bar; 'bar'; end }
103
103
  @barcode = Barcode.new
104
104
  end
105
-
105
+
106
106
  it "should respond to registered output methods" do
107
- @barcode.foo.must_equal 'foo'
108
- @barcode.bar.must_equal 'bar'
107
+ assert_equal 'foo', @barcode.foo
108
+ assert_equal 'bar', @barcode.bar
109
109
  end
110
-
110
+
111
111
  it "should send arguments to registered method on outputter class" do
112
112
  @outputter.class_eval{ def foo(*a); a; end; def my_bar(*a); a; end }
113
- @barcode.foo(1,2,3).must_equal [1,2,3]
114
- @barcode.bar('humbaba').must_equal ['humbaba']
113
+ assert_equal [1,2,3], @barcode.foo(1,2,3)
114
+ assert_equal ['humbaba'], @barcode.bar('humbaba')
115
115
  end
116
-
116
+
117
117
  it "should pass block to registered methods" do
118
118
  @outputter.class_eval{ def foo(*a, &b); b.call(*a); end }
119
- @barcode.foo(1,2,3){|*a| a }.must_equal [1,2,3]
119
+ assert_equal [1,2,3], @barcode.foo(1,2,3){|*a| a }
120
120
  end
121
-
121
+
122
122
  it "should be able to get an instance of a specific outputter" do
123
- @barcode.outputter_for(:foo).must_be_instance_of(@outputter)
123
+ assert @barcode.outputter_for(:foo).is_a?(@outputter)
124
124
  end
125
-
125
+
126
126
  it "should be able to get a specific outputter class" do
127
- @barcode.outputter_class_for(:foo).must_equal @outputter
127
+ assert_equal @outputter, @barcode.outputter_class_for(:foo)
128
128
  end
129
-
129
+
130
130
  end
131
131
 
132
132
  end
133
-
134
-
data/test/pdf_417_test.rb CHANGED
@@ -4,42 +4,42 @@ if defined? JRUBY_VERSION
4
4
  require 'barby/barcode/pdf_417'
5
5
 
6
6
  class Pdf417Test < Barby::TestCase
7
-
7
+
8
8
  it "should produce a nice code" do
9
9
  enc = Pdf417.new('Ereshkigal').encoding
10
- enc.must_equal [
10
+ assert_equal [
11
11
  "111111111101010100101111010110011110100111010110001110100011101101011100100001111111101000110100100",
12
- "111111111101010100101111010110000100100110100101110000101011111110101001111001111111101000110100100",
12
+ "111111111101010100101111010110000100100110100101110000101011111110101001111001111111101000110100100",
13
13
  "111111111101010100101101010111111000100100011100110011111010101100001111100001111111101000110100100",
14
- "111111111101010100101111101101111110110100010100011101111011010111110111111001111111101000110100100",
15
- "111111111101010100101101011110000010100110010101110010100011101101110001110001111111101000110100100",
16
- "111111111101010100101111101101110000110101101100000011110011110110111110111001111111101000110100100",
17
- "111111111101010100101101001111001111100110001101001100100010100111101110100001111111101000110100100",
18
- "111111111101010100101111110110010111100111100100101000110010101111111001111001111111101000110100100",
19
- "111111111101010100101010011101111100100101111110001110111011111101001110110001111111101000110100100",
20
- "111111111101010100101010001111011100100100111110111110111010100101100011100001111111101000110100100",
21
- "111111111101010100101101001111000010100110001101110000101011101100111001110001111111101000110100100",
22
- "111111111101010100101101000110011111100101111111011101100011111110100011100101111111101000110100100",
23
- "111111111101010100101010000101010000100100011100001100101010100100110000111001111111101000110100100",
24
- "111111111101010100101111010100100001100100010100111100101011110110001001100001111111101000110100100",
14
+ "111111111101010100101111101101111110110100010100011101111011010111110111111001111111101000110100100",
15
+ "111111111101010100101101011110000010100110010101110010100011101101110001110001111111101000110100100",
16
+ "111111111101010100101111101101110000110101101100000011110011110110111110111001111111101000110100100",
17
+ "111111111101010100101101001111001111100110001101001100100010100111101110100001111111101000110100100",
18
+ "111111111101010100101111110110010111100111100100101000110010101111111001111001111111101000110100100",
19
+ "111111111101010100101010011101111100100101111110001110111011111101001110110001111111101000110100100",
20
+ "111111111101010100101010001111011100100100111110111110111010100101100011100001111111101000110100100",
21
+ "111111111101010100101101001111000010100110001101110000101011101100111001110001111111101000110100100",
22
+ "111111111101010100101101000110011111100101111111011101100011111110100011100101111111101000110100100",
23
+ "111111111101010100101010000101010000100100011100001100101010100100110000111001111111101000110100100",
24
+ "111111111101010100101111010100100001100100010100111100101011110110001001100001111111101000110100100",
25
25
  "111111111101010100101111010100011110110110011111101001100010100100001001111101111111101000110100100"
26
- ]
27
- enc.length.must_equal 15
28
- enc[0].length.must_equal 99
26
+ ], enc
27
+ assert_equal 15, enc.length
28
+ assert_equal 99, enc[0].length
29
29
  end
30
30
 
31
31
  it "should produce a 19x135 code with default aspect_ratio" do
32
32
  enc = Pdf417.new('qwertyuiopasdfghjklzxcvbnm'*3).encoding
33
- enc.length.must_equal 19
34
- enc[0].length.must_equal 135
33
+ assert_equal 19, enc.length
34
+ assert_equal 135, enc[0].length
35
35
  end
36
36
 
37
37
  it "should produce a 29x117 code with 0.7 aspect_ratio" do
38
- enc = Pdf417.new('qwertyuiopasdfghjklzxcvbnm'*3, :aspect_ratio => 0.7).encoding
39
- enc.length.must_equal 29
40
- enc[0].length.must_equal 117
38
+ enc = Pdf417.new('qwertyuiopasdfghjklzxcvbnm'*3, aspect_ratio: 0.7).encoding
39
+ assert_equal 29, enc.length
40
+ assert_equal 117, enc[0].length
41
41
  end
42
-
42
+
43
43
  end
44
44
 
45
45
  end
data/test/qr_code_test.rb CHANGED
@@ -9,70 +9,75 @@ class QrCodeTest < Barby::TestCase
9
9
  end
10
10
 
11
11
  it "should have the expected data" do
12
- @code.data.must_equal @data
12
+ assert_equal @data, @code.data
13
13
  end
14
14
 
15
15
  it "should have the expected encoding" do
16
16
  # Should be an array of strings, where each string represents a "line"
17
- @code.encoding.must_equal(rqrcode(@code).modules.map do |line|
17
+ expected = rqrcode(@code).modules.map do |line|
18
18
  line.inject(''){|s,m| s << (m ? '1' : '0') }
19
- end)
19
+ end
20
+ assert_equal expected, @code.encoding
20
21
 
21
22
  end
22
-
23
+
23
24
  it "should be able to change its data and output a different encoding" do
24
25
  @code.data = 'hades'
25
- @code.data.must_equal 'hades'
26
- @code.encoding.must_equal(rqrcode(@code).modules.map do |line|
26
+ assert_equal 'hades', @code.data
27
+ expected = rqrcode(@code).modules.map do |line|
27
28
  line.inject(''){|s,m| s << (m ? '1' : '0') }
28
- end)
29
+ end
30
+ assert_equal expected, @code.encoding
29
31
  end
30
-
32
+
31
33
  it "should have a 'level' accessor" do
32
- @code.must_respond_to :level
33
- @code.must_respond_to :level=
34
+ assert @code.respond_to?(:level)
35
+ assert @code.respond_to?(:level=)
34
36
  end
35
-
37
+
36
38
  it "should set size according to size of data" do
37
- QrCode.new('1'*15, :level => :l).size.must_equal 1
38
- QrCode.new('1'*15, :level => :m).size.must_equal 2
39
- QrCode.new('1'*15, :level => :q).size.must_equal 2
40
- QrCode.new('1'*15, :level => :h).size.must_equal 3
41
-
42
- QrCode.new('1'*30, :level => :l).size.must_equal 2
43
- QrCode.new('1'*30, :level => :m).size.must_equal 3
44
- QrCode.new('1'*30, :level => :q).size.must_equal 3
45
- QrCode.new('1'*30, :level => :h).size.must_equal 4
46
-
47
- QrCode.new('1'*270, :level => :l).size.must_equal 10
39
+ assert_equal 1, QrCode.new('1'*15, level: :l).size
40
+ assert_equal 2, QrCode.new('1'*15, level: :m).size
41
+ assert_equal 2, QrCode.new('1'*15, level: :q).size
42
+ assert_equal 3, QrCode.new('1'*15, level: :h).size
43
+
44
+ assert_equal 2, QrCode.new('1'*30, level: :l).size
45
+ assert_equal 3, QrCode.new('1'*30, level: :m).size
46
+ assert_equal 3, QrCode.new('1'*30, level: :q).size
47
+ assert_equal 4, QrCode.new('1'*30, level: :h).size
48
+
49
+ assert_equal 10, QrCode.new('1'*270, level: :l).size
48
50
  end
49
-
51
+
50
52
  it "should allow size to be set manually" do
51
- code = QrCode.new('1'*15, :level => :l, :size => 2)
52
- code.size.must_equal 2
53
- code.encoding.must_equal(rqrcode(code).modules.map do |line|
53
+ code = QrCode.new('1'*15, level: :l, size: 2)
54
+ assert_equal 2, code.size
55
+ expected = rqrcode(code).modules.map do |line|
54
56
  line.inject(''){|s,m| s << (m ? '1' : '0') }
55
- end)
57
+ end
58
+ assert_equal expected, code.encoding
56
59
  end
57
-
60
+
58
61
  it "should raise ArgumentError when data too large" do
59
- assert QrCode.new('1'*2953, :level => :l)
60
- lambda{ QrCode.new('1'*2954, :level => :l) }.must_raise ArgumentError
62
+ QrCode.new('1'*2953, level: :l)
63
+ assert_raises ArgumentError do
64
+ QrCode.new('1'*2954, level: :l)
65
+ end
61
66
  end
62
-
67
+
63
68
  it "should return the original data on to_s" do
64
- @code.to_s.must_equal 'Ereshkigal'
69
+ assert_equal 'Ereshkigal', @code.to_s
65
70
  end
66
-
71
+
67
72
  it "should include at most 20 characters on to_s" do
68
- QrCode.new('123456789012345678901234567890').to_s.must_equal '12345678901234567890'
73
+ assert_equal '12345678901234567890', QrCode.new('123456789012345678901234567890').to_s
69
74
  end
70
75
 
71
-
76
+
72
77
  private
73
-
78
+
74
79
  def rqrcode(code)
75
- RQRCode::QRCode.new(code.data, :level => code.level, :size => code.size)
80
+ RQRCode::QRCode.new(code.data, level: code.level, size: code.size)
76
81
  end
77
82
 
78
83
  end
data/test/test_helper.rb CHANGED
@@ -4,7 +4,7 @@ require 'minitest/autorun'
4
4
  require 'minitest/spec'
5
5
 
6
6
  module Barby
7
- class TestCase < MiniTest::Spec
7
+ class TestCase < Minitest::Spec
8
8
 
9
9
  include Barby
10
10
 
@@ -25,49 +25,49 @@ class UpcSupplementalTest < Barby::TestCase
25
25
  refute UPCSupplemental.new('1b').valid?
26
26
  refute UPCSupplemental.new('a1').valid?
27
27
  end
28
-
28
+
29
29
  describe 'checksum for 5 digits' do
30
-
30
+
31
31
  it 'should have the expected odd_digits' do
32
- UPCSupplemental.new('51234').odd_digits.must_equal [4,2,5]
33
- UPCSupplemental.new('54321').odd_digits.must_equal [1,3,5]
34
- UPCSupplemental.new('99990').odd_digits.must_equal [0,9,9]
32
+ assert_equal [4,2,5], UPCSupplemental.new('51234').odd_digits
33
+ assert_equal [1,3,5], UPCSupplemental.new('54321').odd_digits
34
+ assert_equal [0,9,9], UPCSupplemental.new('99990').odd_digits
35
35
  end
36
36
 
37
37
  it 'should have the expected even_digits' do
38
- UPCSupplemental.new('51234').even_digits.must_equal [3,1]
39
- UPCSupplemental.new('54321').even_digits.must_equal [2,4]
40
- UPCSupplemental.new('99990').even_digits.must_equal [9,9]
38
+ assert_equal [3,1], UPCSupplemental.new('51234').even_digits
39
+ assert_equal [2,4], UPCSupplemental.new('54321').even_digits
40
+ assert_equal [9,9], UPCSupplemental.new('99990').even_digits
41
41
  end
42
42
 
43
43
  it 'should have the expected odd and even sums' do
44
- UPCSupplemental.new('51234').odd_sum.must_equal 33
45
- UPCSupplemental.new('54321').odd_sum.must_equal 27
46
- UPCSupplemental.new('99990').odd_sum.must_equal 54
44
+ assert_equal 33, UPCSupplemental.new('51234').odd_sum
45
+ assert_equal 27, UPCSupplemental.new('54321').odd_sum
46
+ assert_equal 54, UPCSupplemental.new('99990').odd_sum
47
47
 
48
- UPCSupplemental.new('51234').even_sum.must_equal 36
49
- UPCSupplemental.new('54321').even_sum.must_equal 54
50
- UPCSupplemental.new('99990').even_sum.must_equal 162
48
+ assert_equal 36, UPCSupplemental.new('51234').even_sum
49
+ assert_equal 54, UPCSupplemental.new('54321').even_sum
50
+ assert_equal 162, UPCSupplemental.new('99990').even_sum
51
51
  end
52
52
 
53
53
  it 'should have the expected checksum' do
54
- UPCSupplemental.new('51234').checksum.must_equal 9
55
- UPCSupplemental.new('54321').checksum.must_equal 1
56
- UPCSupplemental.new('99990').checksum.must_equal 6
54
+ assert_equal 9, UPCSupplemental.new('51234').checksum
55
+ assert_equal 1, UPCSupplemental.new('54321').checksum
56
+ assert_equal 6, UPCSupplemental.new('99990').checksum
57
57
  end
58
-
58
+
59
59
  end
60
-
60
+
61
61
  describe 'checksum for 2 digits' do
62
-
62
+
63
63
  it 'should have the expected checksum' do
64
- UPCSupplemental.new('51').checksum.must_equal 3
65
- UPCSupplemental.new('21').checksum.must_equal 1
66
- UPCSupplemental.new('99').checksum.must_equal 3
64
+ assert_equal 3, UPCSupplemental.new('51').checksum
65
+ assert_equal 1, UPCSupplemental.new('21').checksum
66
+ assert_equal 3, UPCSupplemental.new('99').checksum
67
67
  end
68
-
68
+
69
69
  end
70
-
70
+
71
71
  describe 'encoding' do
72
72
 
73
73
  before do
@@ -76,27 +76,27 @@ class UpcSupplementalTest < Barby::TestCase
76
76
  end
77
77
 
78
78
  it 'should have the expected encoding' do
79
- # START 5 1 2 3 4
80
- UPCSupplemental.new('51234').encoding.must_equal '1011 0110001 01 0011001 01 0011011 01 0111101 01 0011101'.tr(' ', '')
81
- # 9 9 9 9 0
82
- UPCSupplemental.new('99990').encoding.must_equal '1011 0001011 01 0001011 01 0001011 01 0010111 01 0100111'.tr(' ', '')
83
- # START 5 1
84
- UPCSupplemental.new('51').encoding.must_equal '1011 0111001 01 0110011'.tr(' ', '')
85
- # 2 2
86
- UPCSupplemental.new('22').encoding.must_equal '1011 0011011 01 0010011'.tr(' ', '')
79
+ # START 5 1 2 3 4
80
+ assert_equal '1011 0110001 01 0011001 01 0011011 01 0111101 01 0011101'.tr(' ', ''), UPCSupplemental.new('51234').encoding
81
+ # 9 9 9 9 0
82
+ assert_equal '1011 0001011 01 0001011 01 0001011 01 0010111 01 0100111'.tr(' ', ''), UPCSupplemental.new('99990').encoding
83
+ # START 5 1
84
+ assert_equal '1011 0111001 01 0110011'.tr(' ', ''), UPCSupplemental.new('51').encoding
85
+ # 2 2
86
+ assert_equal '1011 0011011 01 0010011'.tr(' ', ''), UPCSupplemental.new('22').encoding
87
87
  end
88
88
 
89
89
  it 'should be able to change its data' do
90
90
  prev_encoding = @code.encoding
91
91
  @code.data = '99990'
92
- @code.encoding.wont_equal prev_encoding
93
- # 9 9 9 9 0
94
- @code.encoding.must_equal '1011 0001011 01 0001011 01 0001011 01 0010111 01 0100111'.tr(' ', '')
92
+ refute_equal prev_encoding, @code.encoding
93
+ # 9 9 9 9 0
94
+ assert_equal '1011 0001011 01 0001011 01 0001011 01 0010111 01 0100111'.tr(' ', ''), @code.encoding
95
95
  prev_encoding = @code.encoding
96
96
  @code.data = '22'
97
- @code.encoding.wont_equal prev_encoding
98
- # 2 2
99
- @code.encoding.must_equal '1011 0011011 01 0010011'.tr(' ', '')
97
+ refute_equal prev_encoding, @code.encoding
98
+ # 2 2
99
+ assert_equal '1011 0011011 01 0010011'.tr(' ', ''), @code.encoding
100
100
  end
101
101
 
102
102
  end