icu_tournament 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -125,9 +125,10 @@ module ICU
125
125
  attr_reader :error
126
126
 
127
127
  # Parse CSV data returning a Tournament on success or raising an exception on error.
128
- def parse!(csv)
128
+ def parse!(csv, arg={})
129
129
  @state, @line, @round, @sum, @error = 0, 0, nil, nil, nil
130
130
  @tournament = Tournament.new('Dummy', '2000-01-01')
131
+ csv = ICU::Util.to_utf8(csv) unless arg[:is_utf8]
131
132
 
132
133
  CSV.parse(csv, :row_sep => :auto) do |r|
133
134
  @line += 1 # increment line number
@@ -184,8 +185,8 @@ module ICU
184
185
 
185
186
  # Same as <em>parse!</em> except the input is a file name rather than file contents.
186
187
  def parse_file!(file)
187
- csv = open(file) { |f| f.read }
188
- parse!(csv)
188
+ csv = ICU::Util.read_utf8(file)
189
+ parse!(csv, :is_utf8 => true)
189
190
  end
190
191
 
191
192
  # Same as <em>parse</em> except the input is a file name rather than file contents.
@@ -117,6 +117,7 @@ module ICU
117
117
  @name_set, @start_set = false, false
118
118
  @comments = ''
119
119
  @results = Array.new
120
+ krs = ICU::Util.to_utf8(krs) unless arg[:is_utf8]
120
121
 
121
122
  # Process all lines.
122
123
  krs.each_line do |line|
@@ -192,7 +193,8 @@ module ICU
192
193
 
193
194
  # Same as <em>parse!</em> except the input is a file name rather than file contents.
194
195
  def parse_file!(file, arg={})
195
- krause = open(file) { |f| f.read }
196
+ krause = ICU::Util.read_utf8(file)
197
+ arg[:is_utf8] = true
196
198
  parse!(krause, arg)
197
199
  end
198
200
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ICU
4
4
  class Tournament
5
- VERSION = "1.2.7"
5
+ VERSION = "1.2.8"
6
6
  end
7
7
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
3
 
3
4
  module ICU
@@ -15,7 +16,7 @@ module ICU
15
16
  p.results.select{|r| r.rateable}.size.should == rateable
16
17
  p.points.should == points
17
18
  end
18
-
19
+
19
20
  context "a typical tournament" do
20
21
  before(:all) do
21
22
  @csv = <<CSV
@@ -34,27 +35,27 @@ CSV
34
35
  @f = ICU::Tournament::ForeignCSV.new
35
36
  @t = @f.parse!(@csv)
36
37
  end
37
-
38
+
38
39
  it "should have a name" do
39
40
  @t.name.should == 'Bangor Open, 2003'
40
41
  end
41
-
42
+
42
43
  it "should have a start date" do
43
44
  @t.start.should == '2003-07-01'
44
45
  end
45
-
46
+
46
47
  it "should have a number of rounds" do
47
48
  @t.rounds.should == 4
48
49
  end
49
-
50
+
50
51
  it "should have a website" do
51
52
  @t.site.should == 'http://www.icu.ie/tournaments/display.php?id=371'
52
53
  end
53
-
54
+
54
55
  it "should have some players" do
55
56
  @t.should have(4).players
56
57
  end
57
-
58
+
58
59
  it "should have correct player details" do
59
60
  check_player(1, 'Gearoidin', 'Ui Laighleis', 4, 3, 2.0, :id => 3364)
60
61
  check_player(2, 'April', 'Cronin', 1, 0, 1.0, :rating => 2005, :fed => 'IRL')
@@ -62,7 +63,7 @@ CSV
62
63
  check_player(4, 'Linda', 'Powell', 1, 0, 0.0, :rating => 1850, :fed => 'WLS')
63
64
  end
64
65
  end
65
-
66
+
66
67
  context "the rdoc example tournament" do
67
68
  before(:all) do
68
69
  @csv = <<CSV
@@ -89,26 +90,26 @@ CSV
89
90
  @o = @t.players.reject { |o| o.num == 1 }
90
91
  @r = @t.player(2)
91
92
  end
92
-
93
+
93
94
  it "should have correct basic details" do
94
95
  @t.name.should == 'Isle of Man Masters, 2007'
95
96
  @t.start.should == '2007-09-22'
96
97
  @t.rounds.should == 9
97
98
  @t.site.should == 'http://www.bcmchess.co.uk/monarch2007/'
98
99
  end
99
-
100
+
100
101
  it "should have the right number of players in the right order" do
101
102
  @t.players.size.should == 9
102
103
  @t.players.inject(''){ |a,o| a << o.num.to_s }.should == '123456789'
103
104
  end
104
-
105
+
105
106
  it "should have the right details for the main player" do
106
107
  @p.name.should == "Fox, Anthony"
107
108
  @p.results.size == 9
108
109
  @p.results.find_all{ |r| r.rateable }.size.should == 8
109
110
  @p.points.should == 4.0
110
111
  end
111
-
112
+
112
113
  it "should have the right details for the opponents" do
113
114
  @o.size.should == 8
114
115
  @o.find_all{ |o| o.results.size == 1}.size.should == 8
@@ -116,7 +117,7 @@ CSV
116
117
  @r.results[0].rateable.should be_false
117
118
  end
118
119
  end
119
-
120
+
120
121
  context "a tournament with more than one player" do
121
122
  before(:all) do
122
123
  @csv = <<CSV
@@ -158,7 +159,7 @@ CSV
158
159
  check_player(5, 'Bobby', 'Fischer', 1, 0, 0.0, :rating => 2700, :fed => 'USA', :title => 'GM')
159
160
  end
160
161
  end
161
-
162
+
162
163
  context "a tournament where someone is both a player and an opponent" do
163
164
  before(:all) do
164
165
  @csv = <<CSV
@@ -199,11 +200,11 @@ CSV
199
200
  check_player(4, 'April', 'Cronin', 1, 0, 0.5, :rating => 2005, :fed => 'IRL')
200
201
  end
201
202
  end
202
-
203
+
203
204
  context "a file that contains spurious white space and other untidiness" do
204
205
  before(:all) do
205
206
  @csv = <<CSV
206
-
207
+
207
208
  Event," Bratto Open, 2001 "
208
209
  Start, 7th March 2001
209
210
  Rounds, 2
@@ -237,7 +238,7 @@ CSV
237
238
  check_player(3, 'Mark', 'Orr', 1, 0, 0.5, :rating => 2100, :fed => 'IRL', :title => 'IM')
238
239
  end
239
240
  end
240
-
241
+
241
242
  context "#parse" do
242
243
  before(:each) do
243
244
  @f = ICU::Tournament::ForeignCSV.new
@@ -258,7 +259,7 @@ CSV
258
259
  @f.parse(csv).should be_an_instance_of(ICU::Tournament)
259
260
  @f.error.should be_nil
260
261
  end
261
-
262
+
262
263
  it "should not throw an exception but return nil on error" do
263
264
  @f.parse(' ').should be_nil
264
265
  @f.error.should match(/event/)
@@ -269,11 +270,11 @@ CSV
269
270
  before(:each) do
270
271
  @f = ICU::Tournament::ForeignCSV.new
271
272
  end
272
-
273
+
273
274
  it "a blank file is invalid" do
274
275
  lambda { @f.parse!(' ') }.should raise_error(/event/i)
275
276
  end
276
-
277
+
277
278
  it "the event should come first" do
278
279
  csv = <<CSV
279
280
  Start,7th March 2001
@@ -283,7 +284,7 @@ Website,http://www.federscacchi.it/
283
284
  CSV
284
285
  lambda { @f.parse!(csv) }.should raise_error(/line 1.*event/i)
285
286
  end
286
-
287
+
287
288
  it "the start should come second" do
288
289
  csv = <<CSV
289
290
  Event,"Bratto Open, 2001"
@@ -293,7 +294,7 @@ Website,http://www.federscacchi.it/
293
294
  CSV
294
295
  lambda { @f.parse!(csv) }.should raise_error(/line 2.*start/i)
295
296
  end
296
-
297
+
297
298
  it "the number of rounds should come third" do
298
299
  csv = <<CSV
299
300
  Event,"Bratto Open, 2001"
@@ -303,7 +304,7 @@ Rounds,2
303
304
  CSV
304
305
  lambda { @f.parse!(csv) }.should raise_error(/line 3.*rounds/i)
305
306
  end
306
-
307
+
307
308
  it "there should be a web site" do
308
309
  csv = <<CSV
309
310
  Event,"Bratto Open, 2001"
@@ -313,7 +314,7 @@ Rounds,2
313
314
  CSV
314
315
  lambda { @f.parse!(csv) }.should raise_error(/line 4.*site/i)
315
316
  end
316
-
317
+
317
318
  it "should have at least one player" do
318
319
  csv = <<CSV
319
320
  Event,"Bratto Open, 2001"
@@ -323,7 +324,7 @@ Website,http://www.federscacchi.it/
323
324
  CSV
324
325
  lambda { @f.parse!(csv) }.should raise_error(/line 4.*no players/i)
325
326
  end
326
-
327
+
327
328
  it "the player needs to have a valid ID number" do
328
329
  csv = <<CSV
329
330
  Event,"Bratto Open, 2001"
@@ -335,7 +336,7 @@ Player,0,Ui Laighleis,Gearoidin
335
336
  CSV
336
337
  lambda { @f.parse!(csv) }.should raise_error(/line 6.*number/i)
337
338
  end
338
-
339
+
339
340
  it "should have the right number of results for each player" do
340
341
  csv = <<CSV
341
342
  Event,"Bratto Open, 2001"
@@ -349,7 +350,7 @@ Total,0.5
349
350
  CSV
350
351
  lambda { @f.parse!(csv) }.should raise_error(/line 8.*round/i)
351
352
  end
352
-
353
+
353
354
  it "should have correct totals" do
354
355
  csv = <<CSV
355
356
  Event,"Bratto Open, 2001"
@@ -364,8 +365,8 @@ Total,1.5
364
365
  CSV
365
366
  lambda { @f.parse!(csv) }.should raise_error(/line 9.*total/i)
366
367
  end
367
-
368
-
368
+
369
+
369
370
  it "players who match by name and federation should match in all other details" do
370
371
  csv = <<CSV
371
372
  Event,"Bratto Open, 2001"
@@ -386,7 +387,7 @@ CSV
386
387
  lambda { @f.parse!(csv) }.should raise_error(/line 13.*same name.*conflicting/i)
387
388
  end
388
389
  end
389
-
390
+
390
391
  context "serialisation of simple tournament" do
391
392
  before(:each) do
392
393
  @csv = <<CSV
@@ -413,7 +414,7 @@ CSV
413
414
  @f.serialize(@t).should == @csv
414
415
  end
415
416
  end
416
-
417
+
417
418
  context "serialisation of ForeignCSV documentation example" do
418
419
  before(:each) do
419
420
  @csv = <<CSV
@@ -490,7 +491,7 @@ CSV
490
491
  @t.serialize('ForeignCSV').should == @csv
491
492
  end
492
493
  end
493
-
494
+
494
495
  context "serialisation of shortened ForeignCSV documentation example" do
495
496
  before(:each) do
496
497
  @csv = <<CSV
@@ -538,13 +539,47 @@ CSV
538
539
  @t.serialize('ForeignCSV').should == @csv
539
540
  end
540
541
  end
541
-
542
+
543
+ context "encoding" do
544
+ before(:each) do
545
+ @csv = <<CSV
546
+ Event,"Brätto Open, 2001"
547
+ Start,7th March 2001
548
+ Rounds,2
549
+ Website,http://www.federscacchi.it/
550
+
551
+ Player,3364,Uì Laighlèis,Gearoìdin
552
+ 1,=,W,Kasparov,Gary,2800,GM,RUS
553
+ 2,=,B,Örr,Mârk,2100,IM,IRL
554
+ Total,1.0
555
+ CSV
556
+ @f = ICU::Tournament::ForeignCSV.new
557
+ end
558
+
559
+ it "should parse UTF-8" do
560
+ lambda { @t = @f.parse!(@csv) }.should_not raise_error
561
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
562
+ check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :rating => 2800, :fed => 'RUS', :title => 'GM')
563
+ check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :rating => 2100, :fed => 'IRL', :title => 'IM')
564
+ @t.name.should == "Brätto Open, 2001"
565
+ end
566
+
567
+ it "should parse Latin-1" do
568
+ @csv = @csv.encode("ISO-8859-1")
569
+ lambda { @t = @f.parse!(@csv) }.should_not raise_error
570
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
571
+ check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :rating => 2800, :fed => 'RUS', :title => 'GM')
572
+ check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :rating => 2100, :fed => 'IRL', :title => 'IM')
573
+ @t.name.should == "Brätto Open, 2001"
574
+ end
575
+ end
576
+
542
577
  context "parsing files" do
543
578
  before(:each) do
544
579
  @p = ICU::Tournament::ForeignCSV.new
545
580
  @s = File.dirname(__FILE__) + '/samples/fcsv'
546
581
  end
547
-
582
+
548
583
  it "should error on a non-existant valid file" do
549
584
  file = "#{@s}/not_there.csv"
550
585
  lambda { @p.parse_file!(file) }.should raise_error
@@ -552,7 +587,7 @@ CSV
552
587
  t.should be_nil
553
588
  @p.error.should match(/no such file/i)
554
589
  end
555
-
590
+
556
591
  it "should error on an invalid file" do
557
592
  file = "#{@s}/invalid.csv"
558
593
  lambda { @p.parse_file!(file) }.should raise_error
@@ -560,7 +595,7 @@ CSV
560
595
  t.should be_nil
561
596
  @p.error.should match(/expected.*event.*name/i)
562
597
  end
563
-
598
+
564
599
  it "should parse a valid file" do
565
600
  file = "#{@s}/valid.csv"
566
601
  lambda { @p.parse_file!(file) }.should_not raise_error
@@ -568,6 +603,24 @@ CSV
568
603
  t.should be_an_instance_of(ICU::Tournament)
569
604
  t.players.size.should == 16
570
605
  end
606
+
607
+ it "should parse a file encoded in UTF-8" do
608
+ file = "#{@s}/utf-8.csv"
609
+ lambda { @t = @p.parse_file!(file) }.should_not raise_error
610
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
611
+ check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :rating => 2800, :fed => 'RUS', :title => 'GM')
612
+ check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :rating => 2100, :fed => 'IRL', :title => 'IM')
613
+ @t.name.should == "Brätto Open, 2001"
614
+ end
615
+
616
+ it "should parse a file encoded in Latin-1" do
617
+ file = "#{@s}/latin-1.csv"
618
+ lambda { @t = @p.parse_file!(file) }.should_not raise_error
619
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis', 2, 2, 1.0, :id => 3364)
620
+ check_player(2, 'Gary', 'Kasparov', 1, 0, 0.5, :rating => 2800, :fed => 'RUS', :title => 'GM')
621
+ check_player(3, 'Mârk', 'Örr', 1, 0, 0.5, :rating => 2100, :fed => 'IRL', :title => 'IM')
622
+ @t.name.should == "Brätto Open, 2001"
623
+ end
571
624
  end
572
625
 
573
626
  context "type validation" do
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
3
 
3
4
  module ICU
@@ -232,7 +233,7 @@ KRAUSE
232
233
  @t.player(3).rank.should == 3
233
234
  end
234
235
  end
235
-
236
+
236
237
  context "local or FIDE IDs" do
237
238
  before(:each) do
238
239
  @krause = <<KRAUSE
@@ -404,6 +405,36 @@ KRAUSE
404
405
  lambda { t = @p.parse!(@k) }.should raise_error(/opponent/)
405
406
  end
406
407
  end
408
+
409
+ context "encoding" do
410
+ before(:all) do
411
+ @utf8 = <<KRAUSE
412
+ 012 Läs Végas National Opeñ
413
+ 042 2008-06-07
414
+ 001 1 w Uì Laighlèis,Gearoìdin 1.0 2 b 0 3 w 1
415
+ 001 2 m m Örr,Mârk 2.0 1 w 1 3 b 1
416
+ 001 3 m g Bologan,Viktor 0.0 1 b 0 2 w 0
417
+ KRAUSE
418
+ @p = ICU::Tournament::Krause.new
419
+ end
420
+
421
+ it "should handle UTF-8" do
422
+ @t = @p.parse!(@utf8)
423
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis')
424
+ check_player(2, 'Mârk', 'Örr')
425
+ check_player(3, 'Viktor', 'Bologan')
426
+ @t.name.should == "Läs Végas National Opeñ"
427
+ end
428
+
429
+ it "should handle Latin-1" do
430
+ latin1 = @utf8.encode("ISO-8859-1")
431
+ @t = @p.parse!(latin1)
432
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis')
433
+ check_player(2, 'Mârk', 'Örr')
434
+ check_player(3, 'Viktor', 'Bologan')
435
+ @t.name.should == "Läs Végas National Opeñ"
436
+ end
437
+ end
407
438
 
408
439
  context "parsing files" do
409
440
  before(:each) do
@@ -434,6 +465,24 @@ KRAUSE
434
465
  t.should be_an_instance_of(ICU::Tournament)
435
466
  t.players.size.should == 12
436
467
  end
468
+
469
+ it "should parse a file with UTF-8 encoding" do
470
+ file = "#{@s}/utf-8.tab"
471
+ lambda { @t = @p.parse_file!(file) }.should_not raise_error
472
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis')
473
+ check_player(2, 'Mârk', 'Örr')
474
+ check_player(3, 'Viktor', 'Bologan')
475
+ @t.name.should == "Läs Végas National Opeñ"
476
+ end
477
+
478
+ it "should parse a file with Latin-1 encoding" do
479
+ file = "#{@s}/latin-1.tab"
480
+ lambda { @t = @p.parse_file!(file) }.should_not raise_error
481
+ check_player(1, 'Gearoìdin', 'Uì Laighlèis')
482
+ check_player(2, 'Mârk', 'Örr')
483
+ check_player(3, 'Viktor', 'Bologan')
484
+ @t.name.should == "Läs Végas National Opeñ"
485
+ end
437
486
  end
438
487
  end
439
488
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
3
  SAMPLES = File.dirname(__FILE__) + '/samples/sp/'
3
4
 
@@ -25,7 +26,6 @@ module ICU
25
26
  describe SwissPerfect do
26
27
 
27
28
  context "Gonzaga Challengers 2010" do
28
-
29
29
  before(:all) do
30
30
  @p = ICU::Tournament::SwissPerfect.new
31
31
  @t = @p.parse_file(SAMPLES + 'gonzaga_challengers_2010.trn', :start => "2010-01-29")
@@ -58,7 +58,6 @@ module ICU
58
58
  end
59
59
 
60
60
  context "U19 Junior Championships 2010" do
61
-
62
61
  before(:all) do
63
62
  @p = ICU::Tournament::SwissPerfect.new
64
63
  @t = @p.parse_file(SAMPLES + 'junior_championships_u19_2010.sco', :start => "2010-04-11")
@@ -91,7 +90,6 @@ module ICU
91
90
  end
92
91
 
93
92
  context "Limerick Club Championship 2009-10" do
94
-
95
93
  before(:all) do
96
94
  @p = ICU::Tournament::SwissPerfect.new
97
95
  @t = @p.parse_file(SAMPLES + 'LimerickClubChampionship09.ini', :start => "2009-09-15")
@@ -121,7 +119,6 @@ module ICU
121
119
  end
122
120
 
123
121
  context "Junior Inter Provincials U16 2010" do
124
-
125
122
  before(:all) do
126
123
  @p = ICU::Tournament::SwissPerfect.new
127
124
  @t = @p.parse_file(SAMPLES + 'junior_provincials_u16_2010', :start => "2010-02-02")
@@ -149,7 +146,6 @@ module ICU
149
146
  end
150
147
 
151
148
  context "Mulcahy Cup 2010" do
152
-
153
149
  before(:all) do
154
150
  @p = ICU::Tournament::SwissPerfect.new
155
151
  @t = @p.parse_file(SAMPLES + 'mulcahy_2010', :start => "2010-01-15")
@@ -174,7 +170,6 @@ module ICU
174
170
  end
175
171
 
176
172
  context "National Club Champiomships 2010" do
177
-
178
173
  before(:all) do
179
174
  @p = ICU::Tournament::SwissPerfect.new
180
175
  @t = @p.parse_file(SAMPLES + 'ncc', :start => "2010-05-08")
@@ -202,7 +197,6 @@ module ICU
202
197
  end
203
198
 
204
199
  context "Drogheda Section A, 2010, with an invalid federation" do
205
-
206
200
  before(:each) do
207
201
  @p = ICU::Tournament::SwissPerfect.new
208
202
  end
@@ -212,14 +206,14 @@ module ICU
212
206
  t.should be_nil
213
207
  @p.error.should match(/invalid federation/i)
214
208
  end
215
-
209
+
216
210
  it "should parse if instructed to skip bad feds" do
217
211
  t = @p.parse_file(SAMPLES + 'drog_a.zip', :start => "2010-06-04", :fed => :skip)
218
212
  @p.error.should be_nil
219
213
  t.player(5).fed.should be_nil
220
214
  t.player(6).fed.should == "ESP"
221
215
  end
222
-
216
+
223
217
  it "should parse if instructed to skip all feds" do
224
218
  t = @p.parse_file(SAMPLES + 'drog_a.zip', :start => "2010-06-04", :fed => 'ignore')
225
219
  @p.error.should be_nil
@@ -229,7 +223,6 @@ module ICU
229
223
  end
230
224
 
231
225
  context "Non-existant ZIP file" do
232
-
233
226
  before(:all) do
234
227
  @p = ICU::Tournament::SwissPerfect.new
235
228
  @t = @p.parse_file(SAMPLES + 'nosuchzipfile.zip', :start => "2010-05-08")
@@ -255,7 +248,6 @@ module ICU
255
248
  end
256
249
 
257
250
  context "ZIP file containing the wrong number of files" do
258
-
259
251
  before(:all) do
260
252
  @p = ICU::Tournament::SwissPerfect.new
261
253
  @t = @p.parse_file(SAMPLES + 'notenoughfiles.zip', :start => "2010-05-08")
@@ -268,7 +260,6 @@ module ICU
268
260
  end
269
261
 
270
262
  context "ZIP file containing the files with mixed stems" do
271
-
272
263
  before(:all) do
273
264
  @p = ICU::Tournament::SwissPerfect.new
274
265
  @t = @p.parse_file(SAMPLES + 'mixedstems.zip', :start => "2010-05-08")
@@ -281,7 +272,6 @@ module ICU
281
272
  end
282
273
 
283
274
  context "ZIP file" do
284
-
285
275
  before(:all) do
286
276
  @p = ICU::Tournament::SwissPerfect.new
287
277
  @t = @p.parse_file(SAMPLES + 'nccz.zip', :start => "2010-05-08")
@@ -301,7 +291,6 @@ module ICU
301
291
  end
302
292
 
303
293
  context "ZIP file without a ZIP ending" do
304
-
305
294
  before(:all) do
306
295
  @p = ICU::Tournament::SwissPerfect.new
307
296
  end
@@ -315,8 +304,20 @@ module ICU
315
304
  end
316
305
  end
317
306
 
318
- context "Defaulting the start date" do
307
+ context "Names with accented characters" do
308
+ before(:all) do
309
+ @p = ICU::Tournament::SwissPerfect.new
310
+ end
319
311
 
312
+ it "should parse and the name should be in UTF-8" do
313
+ lambda { @t = @p.parse_file!(SAMPLES + 'munster_u10_2011.zip', :start => "2011-01-20") }.should_not raise_error
314
+ @t.player(1).signature.should == "Kennedy, Stephen|||849|2.0|6|12345|WLWLL|BWBWB|TTTTT"
315
+ @t.player(4).signature.should == "Sheehan, Ciarán||||3.0|5|12345|LWWLW|WBWBW|TTTTF"
316
+ @t.player(10).signature.should == "Sheehan, Adam||||2.0|7|12345|WLLWL|WBWWB|TTTFT"
317
+ end
318
+ end
319
+
320
+ context "Defaulting the start date" do
320
321
  before(:all) do
321
322
  @p = ICU::Tournament::SwissPerfect.new
322
323
  @t = @p.parse_file(SAMPLES + 'nccz.zip')
@@ -840,7 +840,7 @@ EOS
840
840
  it "should raise exceptions if the wrong type is used" do
841
841
  lambda { @c.parse_file!("#{@s}/krause/valid.tab", 'ForeignCSV') }.should raise_error(/expected/)
842
842
  lambda { @c.parse_file!("#{@s}/fcsv/valid.csv", 'SwissPerfect') }.should raise_error(/cannot/)
843
- lambda { @c.parse_file!("#{@s}/sp/nccz.zip", 'Krause') }.should raise_error(/(missing|invalid byte sequence)/)
843
+ lambda { @c.parse_file!("#{@s}/sp/nccz.zip", 'Krause') }.should raise_error(/(invalid|conversion)/i)
844
844
  end
845
845
 
846
846
  it "should raise an exception if file does not exist" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 7
9
- version: 1.2.7
8
+ - 8
9
+ version: 1.2.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Orr
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-24 00:00:00 +00:00
17
+ date: 2011-02-04 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency