icu_tournament 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,32 +33,32 @@ module ICU
33
33
  end
34
34
 
35
35
  it "should parse and have the right basic details" do
36
- @p.error.should be_nil
37
- @t.sp_signature.should == "Gonzaga Chess Classic 2010 Challengers Section|Herbert Scarry|6|2010-01-29|56"
36
+ expect(@p.error).to be_nil
37
+ expect(@t.sp_signature).to eq("Gonzaga Chess Classic 2010 Challengers Section|Herbert Scarry|6|2010-01-29|56")
38
38
  end
39
39
 
40
40
  it "should have correct details for selected players" do
41
- @t.player(2).sp_signature.should == "Mullooly, Neil M.|6438||1083||6.0|1|123456|WWWWWW|WBWBWB|TTTTTT" # winner
42
- @t.player(4).sp_signature.should == "Gallagher, Mark|12138||1036||4.0|9|123456|WLWWWL|WBWBWB|FTTTTT" # had one bye
43
- @t.player(45).sp_signature.should == "Catre, Loredan|||507||3.5|18|123456|WDLWLW|BWBWBW|FTTTFT" # had two byes
44
- @t.player(56).sp_signature.should == "McDonnell, Cathal|||498||0.0|54|1|L|-|F" # last
41
+ expect(@t.player(2).sp_signature).to eq("Mullooly, Neil M.|6438||1083||6.0|1|123456|WWWWWW|WBWBWB|TTTTTT") # winner
42
+ expect(@t.player(4).sp_signature).to eq("Gallagher, Mark|12138||1036||4.0|9|123456|WLWWWL|WBWBWB|FTTTTT") # had one bye
43
+ expect(@t.player(45).sp_signature).to eq("Catre, Loredan|||507||3.5|18|123456|WDLWLW|BWBWBW|FTTTFT") # had two byes
44
+ expect(@t.player(56).sp_signature).to eq("McDonnell, Cathal|||498||0.0|54|1|L|-|F") # last
45
45
  end
46
46
 
47
47
  it "original names should be preserved" do
48
- @t.player(2).original_name.should == "MULLOOLY, neil m"
49
- @t.player(4).original_name.should == "Gallagher, Mark"
48
+ expect(@t.player(2).original_name).to eq("MULLOOLY, neil m")
49
+ expect(@t.player(4).original_name).to eq("Gallagher, Mark")
50
50
  end
51
51
 
52
52
  it "should have consistent ranks" do
53
- @t.players.map{ |p| p.rank }.sort.join('').should == (1..@t.players.size).to_a.join('')
53
+ expect(@t.players.map{ |p| p.rank }.sort.join('')).to eq((1..@t.players.size).to_a.join(''))
54
54
  end
55
55
 
56
56
  it "should have the correct tie breaks" do
57
- @t.tie_breaks.join('|').should == "buchholz|harkness|progressive"
57
+ expect(@t.tie_breaks.join('|')).to eq("buchholz|harkness|progressive")
58
58
  end
59
59
 
60
60
  it "should serialize to the text export format" do
61
- @t.serialize('SPExport', :only => [:id, :points]).should == @s
61
+ expect(@t.serialize('SPExport', :only => [:id, :points])).to eq(@s)
62
62
  end
63
63
  end
64
64
 
@@ -70,27 +70,27 @@ module ICU
70
70
  end
71
71
 
72
72
  it "should parse and have the right basic details" do
73
- @p.error.should be_nil
74
- @t.sp_signature.should == "U - 19 All Ireland||3|2010-04-11|4"
73
+ expect(@p.error).to be_nil
74
+ expect(@t.sp_signature).to eq("U - 19 All Ireland||3|2010-04-11|4")
75
75
  end
76
76
 
77
77
  it "should have correct details for selected players" do
78
- @t.player(1).sp_signature.should == "Griffiths, Ryan-Rhys|6897||2225||3.0|1|123|WWW|WWB|TTT"
79
- @t.player(2).sp_signature.should == "Flynn, Jamie|5226||1633||2.0|2|123|WLW|WBW|TTT"
80
- @t.player(3).sp_signature.should == "Hulleman, Leon|6409||1466||1.0|3|123|LWL|BBW|TTT"
81
- @t.player(4).sp_signature.should == "Dunne, Thomas|10914||||0.0|4|123|LLL|BWB|TTT"
78
+ expect(@t.player(1).sp_signature).to eq("Griffiths, Ryan-Rhys|6897||2225||3.0|1|123|WWW|WWB|TTT")
79
+ expect(@t.player(2).sp_signature).to eq("Flynn, Jamie|5226||1633||2.0|2|123|WLW|WBW|TTT")
80
+ expect(@t.player(3).sp_signature).to eq("Hulleman, Leon|6409||1466||1.0|3|123|LWL|BBW|TTT")
81
+ expect(@t.player(4).sp_signature).to eq("Dunne, Thomas|10914||||0.0|4|123|LLL|BWB|TTT")
82
82
  end
83
83
 
84
84
  it "should have consistent ranks" do
85
- @t.players.map{ |p| p.rank }.sort.join('').should == (1..@t.players.size).to_a.join('')
85
+ expect(@t.players.map{ |p| p.rank }.sort.join('')).to eq((1..@t.players.size).to_a.join(''))
86
86
  end
87
87
 
88
88
  it "should have the no tie breaks" do
89
- @t.tie_breaks.join('|').should == ""
89
+ expect(@t.tie_breaks.join('|')).to eq("")
90
90
  end
91
91
 
92
92
  it "should serialize to the text export format" do
93
- @t.rerank.renumber.serialize('SPExport', :only => [:id, :points]).should == @s
93
+ expect(@t.rerank.renumber.serialize('SPExport', :only => [:id, :points])).to eq(@s)
94
94
  end
95
95
  end
96
96
 
@@ -101,25 +101,25 @@ module ICU
101
101
  end
102
102
 
103
103
  it "should parse and have the right basic details" do
104
- @p.error.should be_nil
105
- @t.sp_signature.should == "Limerick Club Championship 2009||7|2009-09-15|19"
104
+ expect(@p.error).to be_nil
105
+ expect(@t.sp_signature).to eq("Limerick Club Championship 2009||7|2009-09-15|19")
106
106
  end
107
107
 
108
108
  it "should have correct details for selected players" do
109
- @t.player(15).sp_signature.should == "Talazec, Laurent|10692||1570||5.5|1|1234567|WWWDDDW|WWBWBWB|FTTTTTT" # winner
110
- @t.player(6).sp_signature.should == "Foenander, Phillip|7168||1434||4.0|7|1234567|WLWLLWW|BWBWBWB|TTFFTTT" # had some byes
111
- @t.player(19).sp_signature.should == "Wall, Robert|||||3.0|14|34567|WWLWL|WWBBW|FTTTT" # didn't play 1st 2 rounds
112
- @t.player(17).sp_signature.should == "Freeman, Conor|||||2.0|16|1234567|DDLWLLL|--BWBWB|FFTTTTT" # had byes and bonus (in BONUS)
113
- @t.player(18).sp_signature.should == "Freeman, Ruiri|||||2.0|17|1234567|DDLLLLW|--WBBWB|FFTTTTF" # had byes and bonus (in BONUS)
114
- @t.player(16).sp_signature.should == "O'Connor, David|||||1.0|19|123|WLL|WBW|FTF" # last
109
+ expect(@t.player(15).sp_signature).to eq("Talazec, Laurent|10692||1570||5.5|1|1234567|WWWDDDW|WWBWBWB|FTTTTTT") # winner
110
+ expect(@t.player(6).sp_signature).to eq("Foenander, Phillip|7168||1434||4.0|7|1234567|WLWLLWW|BWBWBWB|TTFFTTT") # had some byes
111
+ expect(@t.player(19).sp_signature).to eq("Wall, Robert|||||3.0|14|34567|WWLWL|WWBBW|FTTTT") # didn't play 1st 2 rounds
112
+ expect(@t.player(17).sp_signature).to eq("Freeman, Conor|||||2.0|16|1234567|DDLWLLL|--BWBWB|FFTTTTT") # had byes and bonus (in BONUS)
113
+ expect(@t.player(18).sp_signature).to eq("Freeman, Ruiri|||||2.0|17|1234567|DDLLLLW|--WBBWB|FFTTTTF") # had byes and bonus (in BONUS)
114
+ expect(@t.player(16).sp_signature).to eq("O'Connor, David|||||1.0|19|123|WLL|WBW|FTF") # last
115
115
  end
116
116
 
117
117
  it "should have consistent ranks" do
118
- @t.players.map{ |p| p.rank }.sort.join('').should == (1..@t.players.size).to_a.join('')
118
+ expect(@t.players.map{ |p| p.rank }.sort.join('')).to eq((1..@t.players.size).to_a.join(''))
119
119
  end
120
120
 
121
121
  it "should have the correct tie breaks" do
122
- @t.tie_breaks.join('|').should == "harkness|buchholz|progressive"
122
+ expect(@t.tie_breaks.join('|')).to eq("harkness|buchholz|progressive")
123
123
  end
124
124
  end
125
125
 
@@ -130,23 +130,23 @@ module ICU
130
130
  end
131
131
 
132
132
  it "should parse and have the right basic details" do
133
- @p.error.should be_nil
134
- @t.sp_signature.should == "U16 Inter Provincials 2010|David B Murray|3|2010-02-02|18"
133
+ expect(@p.error).to be_nil
134
+ expect(@t.sp_signature).to eq("U16 Inter Provincials 2010|David B Murray|3|2010-02-02|18")
135
135
  end
136
136
 
137
137
  it "should have correct details for selected players" do
138
- @t.player(15).sp_signature.should == "Gupta, Radhika|||1247||3.0|1|123|WWW|BBW|TTT" # won all his games
139
- @t.player(18).sp_signature.should == "Hurley, Thomas|6292||820||1.0|14|1|W|B|F" # scored just 1 from a bye in R1
140
- @t.player(8).sp_signature.should == "Berney, Mark|10328||1948||2.0|3|23|WW|BW|TT" # didn't play in round 1
141
- @t.player(10).sp_signature.should == "O'Donnell, Conor E.|10792||1073||2.0|10|123|LWW|WBW|TFT" # got just 1 point for a bye
138
+ expect(@t.player(15).sp_signature).to eq("Gupta, Radhika|||1247||3.0|1|123|WWW|BBW|TTT") # won all his games
139
+ expect(@t.player(18).sp_signature).to eq("Hurley, Thomas|6292||820||1.0|14|1|W|B|F") # scored just 1 from a bye in R1
140
+ expect(@t.player(8).sp_signature).to eq("Berney, Mark|10328||1948||2.0|3|23|WW|BW|TT") # didn't play in round 1
141
+ expect(@t.player(10).sp_signature).to eq("O'Donnell, Conor E.|10792||1073||2.0|10|123|LWW|WBW|TFT") # got just 1 point for a bye
142
142
  end
143
143
 
144
144
  it "should have consistent ranks" do
145
- @t.players.map{ |p| p.rank }.sort.join('').should == (1..@t.players.size).to_a.join('')
145
+ expect(@t.players.map{ |p| p.rank }.sort.join('')).to eq((1..@t.players.size).to_a.join(''))
146
146
  end
147
147
 
148
148
  it "should have the correct tie breaks" do
149
- @t.tie_breaks.join('|').should == "neustadtl"
149
+ expect(@t.tie_breaks.join('|')).to eq("neustadtl")
150
150
  end
151
151
  end
152
152
 
@@ -157,20 +157,20 @@ module ICU
157
157
  end
158
158
 
159
159
  it "should parse and have the right basic details" do
160
- @p.error.should be_nil
161
- @t.sp_signature.should == "Mulcahy Cup 2010|Stephen Short|6|2010-01-15|50"
160
+ expect(@p.error).to be_nil
161
+ expect(@t.sp_signature).to eq("Mulcahy Cup 2010|Stephen Short|6|2010-01-15|50")
162
162
  end
163
163
 
164
164
  it "should have correct details for selection of players who got bonuses (in MEMO)" do
165
- @t.player(23).sp_signature.should == "Long, Killian|10293||1506||2.5|33|123456|WDLLWL|WWBWBB|TFTTTT"
166
- @t.player(26).sp_signature.should == "Bradley, Michael|6756||1413||3.0|26|123456|DDLWWL|BWWBWW|TFTTTT"
167
- @t.player(15).sp_signature.should == "Twomey, Pat|1637||1656||4.5|7|123456|WDLWWW|WWWBWB|FFTTTT"
168
- @t.player(46).sp_signature.should == "O'Riordan, Pat|10696||900||2.0|42|123456|LDDLDD|BWBWWB|TTTTFT"
169
- @t.player(38).sp_signature.should == "Gill, Craig I.|10637||1081||2.0|43|123456|LLWDDL|BWBWWB|TTTTFT"
165
+ expect(@t.player(23).sp_signature).to eq("Long, Killian|10293||1506||2.5|33|123456|WDLLWL|WWBWBB|TFTTTT")
166
+ expect(@t.player(26).sp_signature).to eq("Bradley, Michael|6756||1413||3.0|26|123456|DDLWWL|BWWBWW|TFTTTT")
167
+ expect(@t.player(15).sp_signature).to eq("Twomey, Pat|1637||1656||4.5|7|123456|WDLWWW|WWWBWB|FFTTTT")
168
+ expect(@t.player(46).sp_signature).to eq("O'Riordan, Pat|10696||900||2.0|42|123456|LDDLDD|BWBWWB|TTTTFT")
169
+ expect(@t.player(38).sp_signature).to eq("Gill, Craig I.|10637||1081||2.0|43|123456|LLWDDL|BWBWWB|TTTTFT")
170
170
  end
171
171
 
172
172
  it "should have consistent ranks" do
173
- @t.players.map{ |p| p.rank }.sort.join('').should == (1..@t.players.size).to_a.join('')
173
+ expect(@t.players.map{ |p| p.rank }.sort.join('')).to eq((1..@t.players.size).to_a.join(''))
174
174
  end
175
175
  end
176
176
 
@@ -181,15 +181,15 @@ module ICU
181
181
  end
182
182
 
183
183
  it "should parse and have the right basic details" do
184
- @p.error.should be_nil
185
- @t.sp_signature.should == "National Club Championship 2010|Gerry Graham|4|2010-05-08|77"
184
+ expect(@p.error).to be_nil
185
+ expect(@t.sp_signature).to eq("National Club Championship 2010|Gerry Graham|4|2010-05-08|77")
186
186
  end
187
187
 
188
188
  it "should have correct details for selection of players, including ICU IDs" do
189
- @t.player(2).sp_signature.should == "Szabo, Gergely|12379|1205064||2530|4.0|4|1234|WWWW|WBWB|TTTT"
190
- @t.player(5).sp_signature.should == "Daly, Colm|295|2500434|2314||3.5|7|1234|WWWD|WBWB|TTTT"
191
- @t.player(8).sp_signature.should == "Vega, Marcos Llaneza||2253585|2475||3.0|16|1234|DDWW|BWBW|TTTT"
192
- @t.player(67).sp_signature.should == "Lee, Shane|780||1633||1.0|52|134|DLD|WWW|TTT"
189
+ expect(@t.player(2).sp_signature).to eq("Szabo, Gergely|12379|1205064||2530|4.0|4|1234|WWWW|WBWB|TTTT")
190
+ expect(@t.player(5).sp_signature).to eq("Daly, Colm|295|2500434|2314||3.5|7|1234|WWWD|WBWB|TTTT")
191
+ expect(@t.player(8).sp_signature).to eq("Vega, Marcos Llaneza||2253585|2475||3.0|16|1234|DDWW|BWBW|TTTT")
192
+ expect(@t.player(67).sp_signature).to eq("Lee, Shane|780||1633||1.0|52|134|DLD|WWW|TTT")
193
193
  end
194
194
  end
195
195
 
@@ -200,22 +200,22 @@ module ICU
200
200
 
201
201
  it "should not parse because of the invalid federation" do
202
202
  t = @p.parse_file(SAMPLES + 'drog_a.zip', :start => "2010-06-04")
203
- t.should be_nil
204
- @p.error.should match(/invalid federation/i)
203
+ expect(t).to be_nil
204
+ expect(@p.error).to match(/invalid federation/i)
205
205
  end
206
206
 
207
207
  it "should parse if instructed to skip bad feds" do
208
208
  t = @p.parse_file(SAMPLES + 'drog_a.zip', :start => "2010-06-04", :fed => :skip)
209
- @p.error.should be_nil
210
- t.player(5).fed.should be_nil
211
- t.player(6).fed.should == "ESP"
209
+ expect(@p.error).to be_nil
210
+ expect(t.player(5).fed).to be_nil
211
+ expect(t.player(6).fed).to eq("ESP")
212
212
  end
213
213
 
214
214
  it "should parse if instructed to skip all feds" do
215
215
  t = @p.parse_file(SAMPLES + 'drog_a.zip', :start => "2010-06-04", :fed => 'ignore')
216
- @p.error.should be_nil
217
- t.player(5).fed.should be_nil
218
- t.player(6).fed.should be_nil
216
+ expect(@p.error).to be_nil
217
+ expect(t.player(5).fed).to be_nil
218
+ expect(t.player(6).fed).to be_nil
219
219
  end
220
220
  end
221
221
 
@@ -226,10 +226,10 @@ module ICU
226
226
 
227
227
  it "should parse" do
228
228
  @t = @p.parse_file(SAMPLES + 'limerick_cc_2011.zip', :start => "2010-10-15")
229
- @p.error.should be_nil
230
- @t.name.should == "Unspecified"
231
- @t.rounds.should == 7
232
- @t.arbiter.should be_nil
229
+ expect(@p.error).to be_nil
230
+ expect(@t.name).to eq("Unspecified")
231
+ expect(@t.rounds).to eq(7)
232
+ expect(@t.arbiter).to be_nil
233
233
  end
234
234
  end
235
235
 
@@ -240,10 +240,10 @@ module ICU
240
240
 
241
241
  it "should parse" do
242
242
  @t = @p.parse_file(SAMPLES + 'phibs_cc_inter_2012.zip', :start => "2012-04-16")
243
- @p.error.should be_nil
244
- @t.name.should == "Phibsboro Club Championship 2012 Inter"
245
- @t.rounds.should == 5
246
- @t.arbiter.should == "Michael Germaine"
243
+ expect(@p.error).to be_nil
244
+ expect(@t.name).to eq("Phibsboro Club Championship 2012 Inter")
245
+ expect(@t.rounds).to eq(5)
246
+ expect(@t.arbiter).to eq("Michael Germaine")
247
247
  end
248
248
  end
249
249
 
@@ -254,8 +254,8 @@ module ICU
254
254
  end
255
255
 
256
256
  it "should not parse and should have a relevant error" do
257
- @t.should be_nil
258
- @p.error.should match(/invalid ZIP file/i)
257
+ expect(@t).to be_nil
258
+ expect(@p.error).to match(/invalid ZIP file/i)
259
259
  end
260
260
  end
261
261
 
@@ -266,8 +266,8 @@ module ICU
266
266
  end
267
267
 
268
268
  it "should not parse and have a should have relevant error" do
269
- @t.should be_nil
270
- @p.error.should match(/invalid ZIP file/i)
269
+ expect(@t).to be_nil
270
+ expect(@p.error).to match(/invalid ZIP file/i)
271
271
  end
272
272
  end
273
273
 
@@ -278,8 +278,8 @@ module ICU
278
278
  end
279
279
 
280
280
  it "should not parse and should have a relevant error" do
281
- @t.should be_nil
282
- @p.error.should match(/3 files/i)
281
+ expect(@t).to be_nil
282
+ expect(@p.error).to match(/3 files/i)
283
283
  end
284
284
  end
285
285
 
@@ -290,8 +290,8 @@ module ICU
290
290
  end
291
291
 
292
292
  it "should not parse and should have a relevant error" do
293
- @t.should be_nil
294
- @p.error.should match(/different stem/i)
293
+ expect(@t).to be_nil
294
+ expect(@p.error).to match(/different stem/i)
295
295
  end
296
296
  end
297
297
 
@@ -302,15 +302,15 @@ module ICU
302
302
  end
303
303
 
304
304
  it "should parse and have the right basic details" do
305
- @p.error.should be_nil
306
- @t.sp_signature.should == "National Club Championship 2010|Gerry Graham|4|2010-05-08|77"
305
+ expect(@p.error).to be_nil
306
+ expect(@t.sp_signature).to eq("National Club Championship 2010|Gerry Graham|4|2010-05-08|77")
307
307
  end
308
308
 
309
309
  it "should have correct details for selection of players, including ICU IDs" do
310
- @t.player(2).sp_signature.should == "Szabo, Gergely|12379|1205064||2530|4.0|4|1234|WWWW|WBWB|TTTT"
311
- @t.player(5).sp_signature.should == "Daly, Colm|295|2500434|2314||3.5|7|1234|WWWD|WBWB|TTTT"
312
- @t.player(8).sp_signature.should == "Vega, Marcos Llaneza||2253585|2475||3.0|16|1234|DDWW|BWBW|TTTT"
313
- @t.player(67).sp_signature.should == "Lee, Shane|780||1633||1.0|52|134|DLD|WWW|TTT"
310
+ expect(@t.player(2).sp_signature).to eq("Szabo, Gergely|12379|1205064||2530|4.0|4|1234|WWWW|WBWB|TTTT")
311
+ expect(@t.player(5).sp_signature).to eq("Daly, Colm|295|2500434|2314||3.5|7|1234|WWWD|WBWB|TTTT")
312
+ expect(@t.player(8).sp_signature).to eq("Vega, Marcos Llaneza||2253585|2475||3.0|16|1234|DDWW|BWBW|TTTT")
313
+ expect(@t.player(67).sp_signature).to eq("Lee, Shane|780||1633||1.0|52|134|DLD|WWW|TTT")
314
314
  end
315
315
  end
316
316
 
@@ -320,11 +320,11 @@ module ICU
320
320
  end
321
321
 
322
322
  it "should not parse unless ZIP format is signalled with an option" do
323
- lambda { @p.parse_file!(SAMPLES + 'nccz.piz', :start => "2010-05-08") }.should raise_error(/cannot find/i)
323
+ expect { @p.parse_file!(SAMPLES + 'nccz.piz', :start => "2010-05-08") }.to raise_error(/cannot find/i)
324
324
  end
325
325
 
326
326
  it "should parse if ZIP format is signalled with an option" do
327
- lambda { @p.parse_file!(SAMPLES + 'nccz.piz', :zip => true, :start => "2010-05-08") }.should_not raise_error
327
+ expect { @p.parse_file!(SAMPLES + 'nccz.piz', :zip => true, :start => "2010-05-08") }.not_to raise_error
328
328
  end
329
329
  end
330
330
 
@@ -334,10 +334,10 @@ module ICU
334
334
  end
335
335
 
336
336
  it "should parse and the name should be in UTF-8" do
337
- lambda { @t = @p.parse_file!(SAMPLES + 'munster_u10_2011.zip', :start => "2011-01-20") }.should_not raise_error
338
- @t.player(1).sp_signature.should == "Kennedy, Stephen|||849||2.0|6|12345|WLWLL|BWBWB|TTTTT"
339
- @t.player(4).sp_signature.should == "Sheehan, Ciarán|||||3.0|5|12345|LWWLW|WBWBW|TTTTF"
340
- @t.player(10).sp_signature.should == "Sheehan, Adam|||||2.0|7|12345|WLLWL|WBWWB|TTTFT"
337
+ expect { @t = @p.parse_file!(SAMPLES + 'munster_u10_2011.zip', :start => "2011-01-20") }.not_to raise_error
338
+ expect(@t.player(1).sp_signature).to eq("Kennedy, Stephen|||849||2.0|6|12345|WLWLL|BWBWB|TTTTT")
339
+ expect(@t.player(4).sp_signature).to eq("Sheehan, Ciarán|||||3.0|5|12345|LWWLW|WBWBW|TTTTF")
340
+ expect(@t.player(10).sp_signature).to eq("Sheehan, Adam|||||2.0|7|12345|WLLWL|WBWWB|TTTFT")
341
341
  end
342
342
  end
343
343
 
@@ -348,7 +348,7 @@ module ICU
348
348
  end
349
349
 
350
350
  it "should default the start date if not supplied" do
351
- @t.start.should == "2000-01-01"
351
+ expect(@t.start).to eq("2000-01-01")
352
352
  end
353
353
  end
354
354
  end
@@ -4,7 +4,7 @@ module ICU
4
4
  describe Tournament do
5
5
  context "a basic tournament" do
6
6
  it "has a name, start date, some players and some results" do
7
- lambda do
7
+ expect do
8
8
  t = Tournament.new('Bangor Bash', '2009-11-09')
9
9
  t.add_player(Player.new('Bobby', 'Fischer', 1))
10
10
  t.add_player(Player.new('Garry', 'Kasparov', 2))
@@ -13,7 +13,7 @@ module ICU
13
13
  t.add_result(Result.new(2, 2, 'L', :opponent => 3, :colour => 'W'))
14
14
  t.add_result(Result.new(3, 3, 'W', :opponent => 1, :colour => 'W'))
15
15
  t.validate!
16
- end.should_not raise_error
16
+ end.not_to raise_error
17
17
  end
18
18
  end
19
19
 
@@ -39,7 +39,7 @@ EOS
39
39
 
40
40
  it "should serialize to Krause" do
41
41
  parser = ICU::Tournament::Krause.new
42
- parser.serialize(@t).should == @s
42
+ expect(parser.serialize(@t)).to eq(@s)
43
43
  end
44
44
  end
45
45
 
@@ -49,17 +49,17 @@ EOS
49
49
  end
50
50
 
51
51
  it "must be specified in constructor" do
52
- @t.name.should == 'Edinburgh Masters'
52
+ expect(@t.name).to eq('Edinburgh Masters')
53
53
  end
54
54
 
55
55
  it "can be replaced by accessor" do
56
56
  @t.name = 'Bangor Bashers'
57
- @t.name.should == 'Bangor Bashers'
57
+ expect(@t.name).to eq('Bangor Bashers')
58
58
  end
59
59
 
60
60
  it "should not be blank or without letters" do
61
- lambda { Tournament.new(' ', '2009-11-09') }.should raise_error(/invalid.*name/)
62
- lambda { @t.name = '333' }.should raise_error(/invalid.*name/)
61
+ expect { Tournament.new(' ', '2009-11-09') }.to raise_error(/invalid.*name/)
62
+ expect { @t.name = '333' }.to raise_error(/invalid.*name/)
63
63
  end
64
64
  end
65
65
 
@@ -69,21 +69,21 @@ EOS
69
69
  end
70
70
 
71
71
  it "may be specified in constructor" do
72
- @t.city.should == 'Edinburgh'
72
+ expect(@t.city).to eq('Edinburgh')
73
73
  end
74
74
 
75
75
  it "can be replaced by accessor" do
76
76
  @t.city = 'Glasgow'
77
- @t.city.should == 'Glasgow'
77
+ expect(@t.city).to eq('Glasgow')
78
78
  end
79
79
 
80
80
  it "can be set to nil" do
81
81
  @t.city = ''
82
- @t.city.should be_nil
82
+ expect(@t.city).to be_nil
83
83
  end
84
84
 
85
85
  it "should not be without letters if set" do
86
- lambda { @t.city = '123' }.should raise_error(/invalid.*city/)
86
+ expect { @t.city = '123' }.to raise_error(/invalid.*city/)
87
87
  end
88
88
  end
89
89
 
@@ -93,26 +93,26 @@ EOS
93
93
  end
94
94
 
95
95
  it "may be specified in constructor" do
96
- @t.fed.should == 'SCO'
96
+ expect(@t.fed).to eq('SCO')
97
97
  end
98
98
 
99
99
  it "can be replaced by accessor" do
100
100
  @t.fed = 'IRL'
101
- @t.fed.should == 'IRL'
101
+ expect(@t.fed).to eq('IRL')
102
102
  end
103
103
 
104
104
  it "can be set to nil" do
105
105
  @t.fed = ''
106
- @t.fed.should be_nil
106
+ expect(@t.fed).to be_nil
107
107
  end
108
108
 
109
109
  it "three letters will automatically be upcased" do
110
110
  @t.fed = 'rus'
111
- @t.fed.should == 'RUS'
111
+ expect(@t.fed).to eq('RUS')
112
112
  end
113
113
 
114
114
  it "should not be without letters if set" do
115
- lambda { @t.fed = '123' }.should raise_error(/invalid.*federation/)
115
+ expect { @t.fed = '123' }.to raise_error(/invalid.*federation/)
116
116
  end
117
117
  end
118
118
 
@@ -122,17 +122,17 @@ EOS
122
122
  end
123
123
 
124
124
  it "must be specified in constructor" do
125
- @t.start.should == '2009-11-09'
125
+ expect(@t.start).to eq('2009-11-09')
126
126
  end
127
127
 
128
128
  it "can be replaced by accessor" do
129
129
  @t.start = '16th June 2010'
130
- @t.start.should == '2010-06-16'
130
+ expect(@t.start).to eq('2010-06-16')
131
131
  end
132
132
 
133
133
  it "should be a valid date" do
134
- lambda { Tournament.new('Edinburgh Masters', ' ') }.should raise_error(/invalid.*date/)
135
- lambda { @t.start = 'X' }.should raise_error(/invalid.*date/)
134
+ expect { Tournament.new('Edinburgh Masters', ' ') }.to raise_error(/invalid.*date/)
135
+ expect { @t.start = 'X' }.to raise_error(/invalid.*date/)
136
136
  end
137
137
  end
138
138
 
@@ -142,35 +142,35 @@ EOS
142
142
  end
143
143
 
144
144
  it "may be specified in constructor" do
145
- @t.finish.should == '2009-11-12'
145
+ expect(@t.finish).to eq('2009-11-12')
146
146
  end
147
147
 
148
148
  it "can be replaced by accessor" do
149
149
  @t.finish = '16th December 2009'
150
- @t.finish.should == '2009-12-16'
150
+ expect(@t.finish).to eq('2009-12-16')
151
151
  end
152
152
 
153
153
  it "can be set to nil" do
154
154
  @t.finish = ''
155
- @t.finish.should be_nil
155
+ expect(@t.finish).to be_nil
156
156
  end
157
157
 
158
158
  it "should be a valid date" do
159
- lambda { Tournament.new('Edinburgh Masters', '2009-11-09', :finish => 'next week') }.should raise_error(/invalid.*date/)
160
- lambda { @t.finish = 'X' }.should raise_error(/invalid.*date/)
159
+ expect { Tournament.new('Edinburgh Masters', '2009-11-09', :finish => 'next week') }.to raise_error(/invalid.*date/)
160
+ expect { @t.finish = 'X' }.to raise_error(/invalid.*date/)
161
161
  end
162
162
  end
163
163
 
164
164
  context "rounds" do
165
165
  it "defaults to nil" do
166
- Tournament.new('Edinburgh Masters', '2009-11-09').rounds.should be_nil
166
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09').rounds).to be_nil
167
167
  end
168
168
 
169
169
  it "should be a positive integer or nil" do
170
- Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => 3).rounds.should == 3
171
- Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => ' 10 ').rounds.should == 10
172
- Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => nil).rounds.should be_nil
173
- lambda { Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => ' 0 ') }.should raise_error(/invalid.*rounds/)
170
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => 3).rounds).to eq(3)
171
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => ' 10 ').rounds).to eq(10)
172
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => nil).rounds).to be_nil
173
+ expect { Tournament.new('Edinburgh Masters', '2009-11-09', :rounds => ' 0 ') }.to raise_error(/invalid.*rounds/)
174
174
  end
175
175
  end
176
176
 
@@ -183,13 +183,13 @@ EOS
183
183
  end
184
184
 
185
185
  it "depends on the players results" do
186
- @t.last_round.should == 0
186
+ expect(@t.last_round).to eq(0)
187
187
  @t.add_result(Result.new(1, 1, 'W', :opponent => 2))
188
- @t.last_round.should == 1
188
+ expect(@t.last_round).to eq(1)
189
189
  @t.add_result(Result.new(2, 2, 'D', :opponent => 3))
190
- @t.last_round.should == 2
190
+ expect(@t.last_round).to eq(2)
191
191
  @t.add_result(Result.new(5, 3, 'L', :opponent => 1))
192
- @t.last_round.should == 5
192
+ expect(@t.last_round).to eq(5)
193
193
  end
194
194
  end
195
195
 
@@ -199,26 +199,26 @@ EOS
199
199
  end
200
200
 
201
201
  it "should default to none" do
202
- @t.round_dates.size.should == 0
202
+ expect(@t.round_dates.size).to eq(0)
203
203
  end
204
204
 
205
205
  it "should be added one by one in the correct order" do
206
206
  @t.add_round_date('09/11/2009')
207
207
  @t.add_round_date('10th November 2009')
208
208
  @t.add_round_date('2009-11-11')
209
- @t.round_dates.join('|').should == '2009-11-09|2009-11-10|2009-11-11'
209
+ expect(@t.round_dates.join('|')).to eq('2009-11-09|2009-11-10|2009-11-11')
210
210
  end
211
211
  end
212
212
 
213
213
  context "site" do
214
214
  it "defaults to nil" do
215
- Tournament.new('Edinburgh Masters', '2009-11-09').site.should be_nil
215
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09').site).to be_nil
216
216
  end
217
217
 
218
218
  it "should be a reasonably valid looking URL" do
219
- Tournament.new('Edinburgh Masters', '2009-11-09', :site => 'https://www.bbc.co.uk').site.should == 'https://www.bbc.co.uk'
220
- Tournament.new('Edinburgh Masters', '2009-11-09', :site => 'www.icu.ie/event.php?id=1').site.should == 'http://www.icu.ie/event.php?id=1'
221
- lambda { Tournament.new('Edinburgh Masters', '2009-11-09', :site => 'X') }.should raise_error(/invalid.*site/)
219
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09', :site => 'https://www.bbc.co.uk').site).to eq('https://www.bbc.co.uk')
220
+ expect(Tournament.new('Edinburgh Masters', '2009-11-09', :site => 'www.icu.ie/event.php?id=1').site).to eq('http://www.icu.ie/event.php?id=1')
221
+ expect { Tournament.new('Edinburgh Masters', '2009-11-09', :site => 'X') }.to raise_error(/invalid.*site/)
222
222
  end
223
223
  end
224
224
 
@@ -228,39 +228,39 @@ EOS
228
228
  end
229
229
 
230
230
  it "may be specified in constructor" do
231
- @t.type.should == 'Swiss'
232
- @t.arbiter.should == 'Gerry Graham'
233
- @t.deputy.should == 'Herbert Scarry'
234
- @t.time_control.should == '120 minutes'
231
+ expect(@t.type).to eq('Swiss')
232
+ expect(@t.arbiter).to eq('Gerry Graham')
233
+ expect(@t.deputy).to eq('Herbert Scarry')
234
+ expect(@t.time_control).to eq('120 minutes')
235
235
  end
236
236
 
237
237
  it "can be replaced by accessor" do
238
238
  @t.type = 'all-play-all'
239
- @t.type.should == 'all-play-all'
239
+ expect(@t.type).to eq('all-play-all')
240
240
  @t.arbiter = 'Michael Crowe'
241
- @t.arbiter.should == 'Michael Crowe'
241
+ expect(@t.arbiter).to eq('Michael Crowe')
242
242
  @t.deputy = 'Mark Orr'
243
- @t.deputy.should == 'Mark Orr'
243
+ expect(@t.deputy).to eq('Mark Orr')
244
244
  @t.time_control = '90 minutes'
245
- @t.time_control.should == '90 minutes'
245
+ expect(@t.time_control).to eq('90 minutes')
246
246
  end
247
247
 
248
248
  it "can be set to nil" do
249
249
  @t.type = ''
250
- @t.type.should be_nil
250
+ expect(@t.type).to be_nil
251
251
  @t.arbiter = ''
252
- @t.arbiter.should be_nil
252
+ expect(@t.arbiter).to be_nil
253
253
  @t.deputy = ''
254
- @t.deputy.should be_nil
254
+ expect(@t.deputy).to be_nil
255
255
  @t.time_control = ''
256
- @t.time_control.should be_nil
256
+ expect(@t.time_control).to be_nil
257
257
  end
258
258
 
259
259
  it "should be valid" do
260
- lambda { @t.type = '123' }.should raise_error(/invalid.*type/)
261
- lambda { @t.arbiter = '123' }.should raise_error(/invalid.*arbiter/)
262
- lambda { @t.deputy = '123' }.should raise_error(/invalid.*deputy/)
263
- lambda { @t.time_control = 'abc' }.should raise_error(/invalid.*time.*control/)
260
+ expect { @t.type = '123' }.to raise_error(/invalid.*type/)
261
+ expect { @t.arbiter = '123' }.to raise_error(/invalid.*arbiter/)
262
+ expect { @t.deputy = '123' }.to raise_error(/invalid.*deputy/)
263
+ expect { @t.time_control = 'abc' }.to raise_error(/invalid.*time.*control/)
264
264
  end
265
265
  end
266
266
 
@@ -270,28 +270,28 @@ EOS
270
270
  end
271
271
 
272
272
  it "should an empty tie breaks list by default" do
273
- @t.tie_breaks.should be_an_instance_of(Array)
274
- @t.tie_breaks.should be_empty
273
+ expect(@t.tie_breaks).to be_an_instance_of(Array)
274
+ expect(@t.tie_breaks).to be_empty
275
275
  end
276
276
 
277
277
  it "should be settable to one or more valid tie break methods" do
278
278
  @t.tie_breaks = [:neustadtl]
279
- @t.tie_breaks.join('|').should == "neustadtl"
279
+ expect(@t.tie_breaks.join('|')).to eq("neustadtl")
280
280
  @t.tie_breaks = [:neustadtl, :blacks]
281
- @t.tie_breaks.join('|').should == "neustadtl|blacks"
281
+ expect(@t.tie_breaks.join('|')).to eq("neustadtl|blacks")
282
282
  @t.tie_breaks = ['Wins', 'Sonneborn-Berger', :harkness]
283
- @t.tie_breaks.join('|').should == "wins|neustadtl|harkness"
283
+ expect(@t.tie_breaks.join('|')).to eq("wins|neustadtl|harkness")
284
284
  @t.tie_breaks = []
285
- @t.tie_breaks.join('|').should == ""
285
+ expect(@t.tie_breaks.join('|')).to eq("")
286
286
  end
287
287
 
288
288
  it "should rasie an error is not given an array" do
289
- lambda { @t.tie_breaks = :neustadtl }.should raise_error(/array/i)
289
+ expect { @t.tie_breaks = :neustadtl }.to raise_error(/array/i)
290
290
  end
291
291
 
292
292
  it "should rasie an error is given any invalid tie-break methods" do
293
- lambda { @t.tie_breaks = ["My Bum"] }.should raise_error(/invalid/i)
294
- lambda { @t.tie_breaks = [:neustadtl, "Your arse"] }.should raise_error(/invalid/i)
293
+ expect { @t.tie_breaks = ["My Bum"] }.to raise_error(/invalid/i)
294
+ expect { @t.tie_breaks = [:neustadtl, "Your arse"] }.to raise_error(/invalid/i)
295
295
  end
296
296
  end
297
297
 
@@ -302,15 +302,15 @@ EOS
302
302
 
303
303
  it "should have unique numbers" do
304
304
  @t.add_player(Player.new('Mark', 'Orr', 1))
305
- lambda { @t.add_player(Player.new('Bobby', 'Fischer', 1)) }.should raise_error(/player.*unique/)
305
+ expect { @t.add_player(Player.new('Bobby', 'Fischer', 1)) }.to raise_error(/player.*unique/)
306
306
  end
307
307
 
308
308
  it "can be added one at a time" do
309
309
  @t.add_player(Player.new('Mark', 'Orr', -1))
310
310
  @t.add_player(Player.new('Gary', 'Kasparov', -2))
311
311
  @t.add_player(Player.new('Bobby', 'Fischer', -3))
312
- @t.players.size.should == 3
313
- @t.player(-1).first_name.should == 'Mark'
312
+ expect(@t.players.size).to eq(3)
313
+ expect(@t.player(-1).first_name).to eq('Mark')
314
314
  end
315
315
  end
316
316
 
@@ -326,38 +326,38 @@ EOS
326
326
  @t.add_result(Result.new(1, 1, 'W', :opponent => 2))
327
327
  @t.add_result(Result.new(2, 2, 'D', :opponent => 3))
328
328
  @t.add_result(Result.new(3, 3, 'L', :opponent => 1, :rateable => false))
329
- @mark.results.size.should == 2
330
- @mark.points.should == 2.0
331
- @gary.results.size.should == 2
332
- @gary.points.should == 0.5
333
- @boby.results.size.should == 2
334
- @boby.points.should == 0.5
329
+ expect(@mark.results.size).to eq(2)
330
+ expect(@mark.points).to eq(2.0)
331
+ expect(@gary.results.size).to eq(2)
332
+ expect(@gary.points).to eq(0.5)
333
+ expect(@boby.results.size).to eq(2)
334
+ expect(@boby.points).to eq(0.5)
335
335
  end
336
336
 
337
337
  it "results with asymmetric scores cannot be added unless both results are unrateable" do
338
338
  @t.add_result(Result.new(1, 1, 'W', :opponent => 2))
339
- lambda { @t.add_result(Result.new(1, 2, 'D', :opponent => 1)) }.should raise_error(/result.*match/)
340
- lambda { @t.add_result(Result.new(1, 2, 'L', :opponent => 1, :rateable => false)) }.should raise_error(/result.*match/)
341
- lambda { @t.add_result(Result.new(3, 3, 'L', :opponent => 1, :rateable => false)) }.should_not raise_error
339
+ expect { @t.add_result(Result.new(1, 2, 'D', :opponent => 1)) }.to raise_error(/result.*match/)
340
+ expect { @t.add_result(Result.new(1, 2, 'L', :opponent => 1, :rateable => false)) }.to raise_error(/result.*match/)
341
+ expect { @t.add_result(Result.new(3, 3, 'L', :opponent => 1, :rateable => false)) }.not_to raise_error
342
342
  end
343
343
 
344
344
  it "should have a defined player" do
345
- lambda { @t.add_result(Result.new(1, 4, 'L', :opponent => 1)) }.should raise_error(/player.*exist/)
345
+ expect { @t.add_result(Result.new(1, 4, 'L', :opponent => 1)) }.to raise_error(/player.*exist/)
346
346
  end
347
347
 
348
348
  it "should have a defined opponent" do
349
- lambda { @t.add_result(Result.new(1, 1, 'W', :opponent => 4)) }.should raise_error(/opponent.*exist/)
349
+ expect { @t.add_result(Result.new(1, 1, 'W', :opponent => 4)) }.to raise_error(/opponent.*exist/)
350
350
  end
351
351
 
352
352
  it "should be consistent with the tournament's number of rounds" do
353
- lambda { @t.add_result(Result.new(4, 1, 'W', :opponent => 2)) }.should raise_error(/round/)
353
+ expect { @t.add_result(Result.new(4, 1, 'W', :opponent => 2)) }.to raise_error(/round/)
354
354
  end
355
355
 
356
356
  it "documentation example should ne correct" do
357
357
  @t.add_result(ICU::Result.new(3, 2, 'L', :opponent => 1, :rateable => false))
358
358
  @t.add_result(ICU::Result.new(3, 1, 'L', :opponent => 2, :rateable => false))
359
- @t.player(1).results.first.points.should == 0.0
360
- @t.player(2).results.first.points.should == 0.0
359
+ expect(@t.player(1).results.first.points).to eq(0.0)
360
+ expect(@t.player(2).results.first.points).to eq(0.0)
361
361
  end
362
362
  end
363
363
 
@@ -370,10 +370,10 @@ EOS
370
370
  end
371
371
 
372
372
  it "should find players based on loose equality" do
373
- @t.find_player(Player.new('Mark', 'Orr', 4, :fed => 'IRL')).num.should == 3
374
- @t.find_player(Player.new('Mark', 'Orr', 4, :fed => 'USA')).should be_nil
375
- @t.find_player(Player.new('Mark', 'Sax', 4, :fed => 'IRL')).should be_nil
376
- @t.find_player(Player.new('John', 'Orr', 4, :fed => 'IRL')).should be_nil
373
+ expect(@t.find_player(Player.new('Mark', 'Orr', 4, :fed => 'IRL')).num).to eq(3)
374
+ expect(@t.find_player(Player.new('Mark', 'Orr', 4, :fed => 'USA'))).to be_nil
375
+ expect(@t.find_player(Player.new('Mark', 'Sax', 4, :fed => 'IRL'))).to be_nil
376
+ expect(@t.find_player(Player.new('John', 'Orr', 4, :fed => 'IRL'))).to be_nil
377
377
  end
378
378
  end
379
379
 
@@ -384,21 +384,21 @@ EOS
384
384
 
385
385
  it "should be able to create a new team, add it and retrieve it" do
386
386
  team = Team.new('Wandering Dragons')
387
- @t.add_team(team).should be_an_instance_of Team
388
- @t.get_team(' wandering dragons ').should be_an_instance_of Team
389
- @t.get_team('Blundering Bishops').should be_nil
387
+ expect(@t.add_team(team)).to be_an_instance_of Team
388
+ expect(@t.get_team(' wandering dragons ')).to be_an_instance_of Team
389
+ expect(@t.get_team('Blundering Bishops')).to be_nil
390
390
  end
391
391
 
392
392
  it "should be able to create and add a new team and retrieve it" do
393
- @t.add_team('Blundering Bishops').should be_an_instance_of Team
394
- @t.get_team(' blundering bishops ').should be_an_instance_of Team
395
- @t.get_team('Wandering Dragons').should be_nil
393
+ expect(@t.add_team('Blundering Bishops')).to be_an_instance_of Team
394
+ expect(@t.get_team(' blundering bishops ')).to be_an_instance_of Team
395
+ expect(@t.get_team('Wandering Dragons')).to be_nil
396
396
  end
397
397
 
398
398
  it "should throw and exception if there is an attempt to add a team with a name that matches an existing team" do
399
- lambda { @t.add_team('Blundering Bishops') }.should_not raise_error
400
- lambda { @t.add_team('Wandering Dragons') }.should_not raise_error
401
- lambda { @t.add_team(' wandering dragons ') }.should raise_error(/similar.*exists/)
399
+ expect { @t.add_team('Blundering Bishops') }.not_to raise_error
400
+ expect { @t.add_team('Wandering Dragons') }.not_to raise_error
401
+ expect { @t.add_team(' wandering dragons ') }.to raise_error(/similar.*exists/)
402
402
  end
403
403
  end
404
404
 
@@ -417,42 +417,42 @@ EOS
417
417
  end
418
418
 
419
419
  it "should be valid" do
420
- @t.invalid.should be_false
420
+ expect(@t.invalid).to be_falsey
421
421
  end
422
422
 
423
423
  it "should have side effect of setting number of rounds" do
424
- @t.rounds.should be_nil
424
+ expect(@t.rounds).to be_nil
425
425
  @t.invalid
426
- @t.rounds.should == 3
426
+ expect(@t.rounds).to eq(3)
427
427
  end
428
428
 
429
429
  it "should detect an inconsistent start date" do
430
430
  @t.start = '2009-11-10'
431
- lambda { @t.validate! }.should raise_error(/first round.*not match.*start/)
431
+ expect { @t.validate! }.to raise_error(/first round.*not match.*start/)
432
432
  end
433
433
 
434
434
  it "should detect an inconsistent finish date" do
435
435
  @t.finish = '2009-11-10'
436
- lambda { @t.validate! }.should raise_error(/last round.*not match.*end/)
436
+ expect { @t.validate! }.to raise_error(/last round.*not match.*end/)
437
437
  end
438
438
 
439
439
  it "should have side effect of setting missing finish date" do
440
- @t.finish.should be_nil
440
+ expect(@t.finish).to be_nil
441
441
  @t.invalid
442
- @t.finish.should == '2009-11-11'
442
+ expect(@t.finish).to eq('2009-11-11')
443
443
  end
444
444
 
445
445
  it "should detect inconsistent round dates" do
446
446
  @t.add_round_date('2009-11-12')
447
- lambda { @t.validate! }.should raise_error(/round dates.*match.*rounds/)
447
+ expect { @t.validate! }.to raise_error(/round dates.*match.*rounds/)
448
448
  end
449
449
 
450
450
  it "should have the side effect of providing missing ranks if the rerank option is set" do
451
- @t.players.select{ |p| p.rank }.size.should == 0
451
+ expect(@t.players.select{ |p| p.rank }.size).to eq(0)
452
452
  @t.invalid(:rerank => true)
453
- @t.player(1).rank.should == 1
454
- @t.player(2).rank.should == 2
455
- @t.player(3).rank.should == 3
453
+ expect(@t.player(1).rank).to eq(1)
454
+ expect(@t.player(2).rank).to eq(2)
455
+ expect(@t.player(3).rank).to eq(3)
456
456
  end
457
457
 
458
458
  it "should have the side effect of correcting bad ranks if the rerank option is set" do
@@ -460,16 +460,16 @@ EOS
460
460
  @t.player(2).rank = 1
461
461
  @t.player(3).rank = 3
462
462
  @t.invalid(:rerank => true)
463
- @t.player(1).rank.should == 1
464
- @t.player(2).rank.should == 2
465
- @t.player(3).rank.should == 3
463
+ expect(@t.player(1).rank).to eq(1)
464
+ expect(@t.player(2).rank).to eq(2)
465
+ expect(@t.player(3).rank).to eq(3)
466
466
  end
467
467
 
468
468
  it "should detect missranked players" do
469
469
  @t.player(1).rank = 2
470
470
  @t.player(2).rank = 1
471
471
  @t.player(3).rank = 3
472
- lambda { @t.validate! }.should raise_error(/player 2.*above.*player 1/)
472
+ expect { @t.validate! }.to raise_error(/player 2.*above.*player 1/)
473
473
  end
474
474
 
475
475
  it "should be valid if there are teams, every player is in one of them, and no team has an invalid member" do
@@ -477,13 +477,13 @@ EOS
477
477
  team2 = Team.new('World Champions')
478
478
  @t.add_team(team1)
479
479
  @t.add_team(team2)
480
- @t.invalid.should match(/not.*member/)
480
+ expect(@t.invalid).to match(/not.*member/)
481
481
  team1.add_member(1)
482
482
  team2.add_member(2)
483
483
  team2.add_member(3)
484
- @t.invalid.should be_false
484
+ expect(@t.invalid).to be_falsey
485
485
  team1.add_member(4)
486
- @t.invalid.should match(/not.*valid/)
486
+ expect(@t.invalid).to match(/not.*valid/)
487
487
  end
488
488
 
489
489
  it "should not be valid if one player is in more than one team" do
@@ -494,25 +494,25 @@ EOS
494
494
  team2.add_member(3)
495
495
  @t.add_team(team1)
496
496
  @t.add_team(team2)
497
- @t.invalid.should be_false
497
+ expect(@t.invalid).to be_falsey
498
498
  team1.add_member(2)
499
- @t.invalid.should match(/already.*member/)
499
+ expect(@t.invalid).to match(/already.*member/)
500
500
  end
501
501
 
502
502
  it "should not be valid if two players share the same ICU or FIDE ID" do
503
503
  @t.player(1).id = 1350
504
504
  @t.player(2).id = 1350
505
- @t.invalid.should match(/duplicate.*ICU/)
505
+ expect(@t.invalid).to match(/duplicate.*ICU/)
506
506
  end
507
507
 
508
508
  it "should allow players to have no results" do
509
509
  (1..3).each { |r| @t.player(1).remove_result(r) }
510
- @t.invalid.should be_false
510
+ expect(@t.invalid).to be_falsey
511
511
  end
512
512
 
513
513
  it "should not allow asymmetric scores for rateable results" do
514
514
  @t.player(1).find_result(1).score = 'L'
515
- @t.invalid.should match(/result.*reverse/)
515
+ expect(@t.invalid).to match(/result.*reverse/)
516
516
  end
517
517
 
518
518
  it "should allow asymmetric scores for unrateable results" do
@@ -522,7 +522,7 @@ EOS
522
522
  r.rateable = false
523
523
  r.score = 'L'
524
524
  end
525
- @t.invalid.should be_false
525
+ expect(@t.invalid).to be_falsey
526
526
  end
527
527
  end
528
528
 
@@ -538,39 +538,39 @@ EOS
538
538
  end
539
539
 
540
540
  it "sample tournament is valid but unranked" do
541
- @t.invalid.should be_false
542
- @t.player(10).rank.should be_nil
543
- @t.players.map{ |p| p.num }.join('|').should == '10|20|30'
544
- @t.players.map{ |p| p.last_name }.join('|').should == 'Fischer|Orr|Kasparov'
541
+ expect(@t.invalid).to be_falsey
542
+ expect(@t.player(10).rank).to be_nil
543
+ expect(@t.players.map{ |p| p.num }.join('|')).to eq('10|20|30')
544
+ expect(@t.players.map{ |p| p.last_name }.join('|')).to eq('Fischer|Orr|Kasparov')
545
545
  end
546
546
 
547
547
  it "should be renumberable by name in the absence of ranking" do
548
548
  @t.renumber
549
- @t.invalid.should be_false
550
- @t.players.map{ |p| p.num }.join('|').should == '1|2|3'
551
- @t.players.map{ |p| p.last_name }.join('|').should == 'Fischer|Kasparov|Orr'
549
+ expect(@t.invalid).to be_falsey
550
+ expect(@t.players.map{ |p| p.num }.join('|')).to eq('1|2|3')
551
+ expect(@t.players.map{ |p| p.last_name }.join('|')).to eq('Fischer|Kasparov|Orr')
552
552
  end
553
553
 
554
554
  it "should be renumberable by rank if the tournament is ranked" do
555
555
  @t.rerank.renumber
556
- @t.invalid.should be_false
557
- @t.players.map{ |p| p.num }.join('|').should == '1|2|3'
558
- @t.players.map{ |p| p.rank }.join('|').should == '1|2|3'
559
- @t.players.map{ |p| p.last_name }.join('|').should == 'Orr|Kasparov|Fischer'
556
+ expect(@t.invalid).to be_falsey
557
+ expect(@t.players.map{ |p| p.num }.join('|')).to eq('1|2|3')
558
+ expect(@t.players.map{ |p| p.rank }.join('|')).to eq('1|2|3')
559
+ expect(@t.players.map{ |p| p.last_name }.join('|')).to eq('Orr|Kasparov|Fischer')
560
560
  end
561
561
 
562
562
  it "should be renumberable by name even if the tourament is ranked" do
563
563
  @t.rerank.renumber(:name)
564
- @t.invalid.should be_false
565
- @t.players.map{ |p| p.num }.join('|').should == '1|2|3'
566
- @t.players.map{ |p| p.last_name }.join('|').should == 'Fischer|Kasparov|Orr'
564
+ expect(@t.invalid).to be_falsey
565
+ expect(@t.players.map{ |p| p.num }.join('|')).to eq('1|2|3')
566
+ expect(@t.players.map{ |p| p.last_name }.join('|')).to eq('Fischer|Kasparov|Orr')
567
567
  end
568
568
 
569
569
  it "should be renumberable by order" do
570
570
  @t.rerank.renumber(:order)
571
- @t.invalid.should be_false
572
- @t.players.map{ |p| p.num }.join('|').should == '1|2|3'
573
- @t.players.map{ |p| p.last_name }.join('|').should == 'Fischer|Orr|Kasparov'
571
+ expect(@t.invalid).to be_falsey
572
+ expect(@t.players.map{ |p| p.num }.join('|')).to eq('1|2|3')
573
+ expect(@t.players.map{ |p| p.last_name }.join('|')).to eq('Fischer|Orr|Kasparov')
574
574
  end
575
575
  end
576
576
 
@@ -595,34 +595,34 @@ EOS
595
595
  end
596
596
 
597
597
  it "should initially be valid but unranked" do
598
- @t.invalid.should be_false
599
- @t.player(1).rank.should be_nil
598
+ expect(@t.invalid).to be_falsey
599
+ expect(@t.player(1).rank).to be_nil
600
600
  end
601
601
 
602
602
  it "should have correct default tie break scores" do
603
603
  scores = @t.tie_break_scores
604
- scores[1].should == 'Fischer, Bobby'
605
- scores[5].should == 'Ui Laighleis, Gearoidin'
604
+ expect(scores[1]).to eq('Fischer, Bobby')
605
+ expect(scores[5]).to eq('Ui Laighleis, Gearoidin')
606
606
  end
607
607
 
608
608
  it "should have correct actual scores" do
609
- @t.player(1).points.should == 3.0
610
- @t.player(2).points.should == 3.0
611
- @t.player(3).points.should == 1.0
612
- @t.player(4).points.should == 1.0
613
- @t.player(5).points.should == 0.5
614
- @t.player(6).points.should == 0.5
609
+ expect(@t.player(1).points).to eq(3.0)
610
+ expect(@t.player(2).points).to eq(3.0)
611
+ expect(@t.player(3).points).to eq(1.0)
612
+ expect(@t.player(4).points).to eq(1.0)
613
+ expect(@t.player(5).points).to eq(0.5)
614
+ expect(@t.player(6).points).to eq(0.5)
615
615
  end
616
616
 
617
617
  it "should have correct Buchholz tie break scores" do
618
618
  @t.tie_breaks = ["Buchholz"]
619
619
  scores = @t.tie_break_scores
620
- scores[1].should == 2.0
621
- scores[2].should == 2.5
622
- scores[3].should == 7.0
623
- scores[4].should == 4.5
624
- scores[5].should == 6.5
625
- scores[6].should == 4.5
620
+ expect(scores[1]).to eq(2.0)
621
+ expect(scores[2]).to eq(2.5)
622
+ expect(scores[3]).to eq(7.0)
623
+ expect(scores[4]).to eq(4.5)
624
+ expect(scores[5]).to eq(6.5)
625
+ expect(scores[6]).to eq(4.5)
626
626
  end
627
627
 
628
628
  it "Buchholz should be sensitive to unplayed games" do
@@ -630,45 +630,45 @@ EOS
630
630
  @t.player(6).find_result(1).opponent = nil
631
631
  @t.tie_breaks = ["Buchholz"]
632
632
  scores = @t.tie_break_scores
633
- scores[1].should == 1.5 # 0.5 from Orr changed to 0
634
- scores[2].should == 2.5 # didn't play Fischer or Orr so unaffected
635
- scores[3].should == 6.5 # 3 from Fischer's changed to 2.5
636
- scores[4].should == 5.0 # 0.5 from Orr changed to 1 (because Orr's unrated loss to Fischer now counts as a draw)
637
- scores[5].should == 6.5 # 3 from Fischer changed to 2.5, 0.5 from Orr changed to 1 (cancels out)
638
- scores[6].should == 1.5 # 3 from Fischer changed to 0
633
+ expect(scores[1]).to eq(1.5) # 0.5 from Orr changed to 0
634
+ expect(scores[2]).to eq(2.5) # didn't play Fischer or Orr so unaffected
635
+ expect(scores[3]).to eq(6.5) # 3 from Fischer's changed to 2.5
636
+ expect(scores[4]).to eq(5.0) # 0.5 from Orr changed to 1 (because Orr's unrated loss to Fischer now counts as a draw)
637
+ expect(scores[5]).to eq(6.5) # 3 from Fischer changed to 2.5, 0.5 from Orr changed to 1 (cancels out)
638
+ expect(scores[6]).to eq(1.5) # 3 from Fischer changed to 0
639
639
  end
640
640
 
641
641
  it "should have correct progressive tie break scores" do
642
642
  @t.tie_breaks = [:progressive]
643
643
  scores = @t.tie_break_scores
644
- scores[1].should == 6.0
645
- scores[2].should == 6.0
646
- scores[3].should == 3.0
647
- scores[4].should == 1.0
648
- scores[5].should == 1.0
649
- scores[6].should == 1.0
644
+ expect(scores[1]).to eq(6.0)
645
+ expect(scores[2]).to eq(6.0)
646
+ expect(scores[3]).to eq(3.0)
647
+ expect(scores[4]).to eq(1.0)
648
+ expect(scores[5]).to eq(1.0)
649
+ expect(scores[6]).to eq(1.0)
650
650
  end
651
651
 
652
652
  it "should have correct ratings tie break scores" do
653
653
  @t.tie_breaks = ['ratings']
654
654
  scores = @t.tie_break_scores
655
- scores[1].should == 4000
656
- scores[2].should == 3200
657
- scores[3].should == 6800
658
- scores[4].should == 5000
659
- scores[5].should == 7600
660
- scores[6].should == 5800
655
+ expect(scores[1]).to eq(4000)
656
+ expect(scores[2]).to eq(3200)
657
+ expect(scores[3]).to eq(6800)
658
+ expect(scores[4]).to eq(5000)
659
+ expect(scores[5]).to eq(7600)
660
+ expect(scores[6]).to eq(5800)
661
661
  end
662
662
 
663
663
  it "should have correct Neustadtl tie break scores" do
664
664
  @t.tie_breaks = [:neustadtl]
665
665
  scores = @t.tie_break_scores
666
- scores[1].should == 2.0
667
- scores[2].should == 2.5
668
- scores[3].should == 1.0
669
- scores[4].should == 0.5
670
- scores[5].should == 0.25
671
- scores[6].should == 0.25
666
+ expect(scores[1]).to eq(2.0)
667
+ expect(scores[2]).to eq(2.5)
668
+ expect(scores[3]).to eq(1.0)
669
+ expect(scores[4]).to eq(0.5)
670
+ expect(scores[5]).to eq(0.25)
671
+ expect(scores[6]).to eq(0.25)
672
672
  end
673
673
 
674
674
  it "Neustadtl should be sensitive to unplayed games" do
@@ -676,41 +676,41 @@ EOS
676
676
  @t.player(6).find_result(1).opponent = nil
677
677
  @t.tie_breaks = ["Neustadtl"]
678
678
  scores = @t.tie_break_scores
679
- scores[1].should == 1.5 # 0.5 from Orr changed to 0
680
- scores[2].should == 2.5 # didn't play Fischer or Orr so unaffected
681
- scores[3].should == 1.0 # win against Minnie unaffected
682
- scores[4].should == 1.0 # 0.5 from Orr changed to 1 (because Orr's unrated loss to Fischer now counts as a draw)
683
- scores[5].should == 0.5 # 0.25 from Orr changed to 0.5
684
- scores[6].should == 0.25 # loss against Fisher and unplayed against Fisher equivalent
679
+ expect(scores[1]).to eq(1.5) # 0.5 from Orr changed to 0
680
+ expect(scores[2]).to eq(2.5) # didn't play Fischer or Orr so unaffected
681
+ expect(scores[3]).to eq(1.0) # win against Minnie unaffected
682
+ expect(scores[4]).to eq(1.0) # 0.5 from Orr changed to 1 (because Orr's unrated loss to Fischer now counts as a draw)
683
+ expect(scores[5]).to eq(0.5) # 0.25 from Orr changed to 0.5
684
+ expect(scores[6]).to eq(0.25) # loss against Fisher and unplayed against Fisher equivalent
685
685
  end
686
686
 
687
687
  it "should have correct Harkness tie break scores" do
688
688
  @t.tie_breaks = ['harkness']
689
689
  scores = @t.tie_break_scores
690
- scores[1].should == 0.5
691
- scores[2].should == 1.0
692
- scores[3].should == 3.0
693
- scores[4].should == 1.0
694
- scores[5].should == 3.0
695
- scores[6].should == 1.0
690
+ expect(scores[1]).to eq(0.5)
691
+ expect(scores[2]).to eq(1.0)
692
+ expect(scores[3]).to eq(3.0)
693
+ expect(scores[4]).to eq(1.0)
694
+ expect(scores[5]).to eq(3.0)
695
+ expect(scores[6]).to eq(1.0)
696
696
  end
697
697
 
698
698
  it "should have correct Modified Median tie break scores" do
699
699
  @t.tie_breaks = ['Modified Median']
700
700
  scores = @t.tie_break_scores
701
- scores[1].should == 1.5
702
- scores[2].should == 2.0
703
- scores[3].should == 4.0
704
- scores[4].should == 1.5
705
- scores[5].should == 3.5
706
- scores[6].should == 1.5
701
+ expect(scores[1]).to eq(1.5)
702
+ expect(scores[2]).to eq(2.0)
703
+ expect(scores[3]).to eq(4.0)
704
+ expect(scores[4]).to eq(1.5)
705
+ expect(scores[5]).to eq(3.5)
706
+ expect(scores[6]).to eq(1.5)
707
707
  end
708
708
 
709
709
  it "should have correct tie break scores for number of blacks" do
710
710
  @t.tie_breaks = ['Blacks']
711
711
  scores = @t.tie_break_scores
712
- scores[3].should == 0
713
- scores[4].should == 2
712
+ expect(scores[3]).to eq(0)
713
+ expect(scores[4]).to eq(2)
714
714
  end
715
715
 
716
716
  it "number of blacks should should be sensitive to unplayed games" do
@@ -718,15 +718,15 @@ EOS
718
718
  @t.player(4).find_result(1).opponent = nil
719
719
  @t.tie_breaks = [:blacks]
720
720
  scores = @t.tie_break_scores
721
- scores[3].should == 0
722
- scores[4].should == 1
721
+ expect(scores[3]).to eq(0)
722
+ expect(scores[4]).to eq(1)
723
723
  end
724
724
 
725
725
  it "should have correct tie break scores for number of wins" do
726
726
  @t.tie_breaks = [:wins]
727
727
  scores = @t.tie_break_scores
728
- scores[1].should == 3
729
- scores[6].should == 0
728
+ expect(scores[1]).to eq(3)
729
+ expect(scores[6]).to eq(0)
730
730
  end
731
731
 
732
732
  it "number of wins should should be sensitive to unplayed games" do
@@ -734,101 +734,101 @@ EOS
734
734
  @t.player(6).find_result(1).opponent = nil
735
735
  @t.tie_breaks = ['WINS']
736
736
  scores = @t.tie_break_scores
737
- scores[1].should == 2
738
- scores[6].should == 0
737
+ expect(scores[1]).to eq(2)
738
+ expect(scores[6]).to eq(0)
739
739
  end
740
740
 
741
741
  it "should use names for tie breaking by default" do
742
742
  @t.rerank
743
- @t.player(1).rank.should == 1 # 3.0/"Fischer"
744
- @t.player(2).rank.should == 2 # 3.0/"Kasparov"
745
- @t.player(3).rank.should == 3 # 1.0/"Mouse,Mickey"
746
- @t.player(4).rank.should == 4 # 1.0/"Mouse,Minnie"
747
- @t.player(6).rank.should == 5 # 0.5/"Ui"
748
- @t.player(5).rank.should == 6 # 0.5/"Orr"
743
+ expect(@t.player(1).rank).to eq(1) # 3.0/"Fischer"
744
+ expect(@t.player(2).rank).to eq(2) # 3.0/"Kasparov"
745
+ expect(@t.player(3).rank).to eq(3) # 1.0/"Mouse,Mickey"
746
+ expect(@t.player(4).rank).to eq(4) # 1.0/"Mouse,Minnie"
747
+ expect(@t.player(6).rank).to eq(5) # 0.5/"Ui"
748
+ expect(@t.player(5).rank).to eq(6) # 0.5/"Orr"
749
749
  end
750
750
 
751
751
  it "should be configurable to use Buchholz" do
752
752
  @t.tie_breaks = ['Buchholz']
753
753
  @t.rerank
754
- @t.player(2).rank.should == 1 # 3.0/2.5
755
- @t.player(1).rank.should == 2 # 3.0/2.0
756
- @t.player(3).rank.should == 3 # 1.0/7.0
757
- @t.player(4).rank.should == 4 # 1.0/4.5
758
- @t.player(5).rank.should == 5 # 0.5/6.5
759
- @t.player(6).rank.should == 6 # 0.5/4.5
754
+ expect(@t.player(2).rank).to eq(1) # 3.0/2.5
755
+ expect(@t.player(1).rank).to eq(2) # 3.0/2.0
756
+ expect(@t.player(3).rank).to eq(3) # 1.0/7.0
757
+ expect(@t.player(4).rank).to eq(4) # 1.0/4.5
758
+ expect(@t.player(5).rank).to eq(5) # 0.5/6.5
759
+ expect(@t.player(6).rank).to eq(6) # 0.5/4.5
760
760
  end
761
761
 
762
762
  it "should be configurable to use Neustadtl" do
763
763
  @t.tie_breaks = [:neustadtl]
764
764
  @t.rerank
765
- @t.player(2).rank.should == 1 # 3.0/2.5
766
- @t.player(1).rank.should == 2 # 3.0/2.0
767
- @t.player(3).rank.should == 3 # 1.0/1.0
768
- @t.player(4).rank.should == 4 # 1.0/0.5
769
- @t.player(6).rank.should == 5 # 0.5/0.25/"Orr"
770
- @t.player(5).rank.should == 6 # 0.5/0.25/"Ui"
765
+ expect(@t.player(2).rank).to eq(1) # 3.0/2.5
766
+ expect(@t.player(1).rank).to eq(2) # 3.0/2.0
767
+ expect(@t.player(3).rank).to eq(3) # 1.0/1.0
768
+ expect(@t.player(4).rank).to eq(4) # 1.0/0.5
769
+ expect(@t.player(6).rank).to eq(5) # 0.5/0.25/"Orr"
770
+ expect(@t.player(5).rank).to eq(6) # 0.5/0.25/"Ui"
771
771
  end
772
772
 
773
773
  it "should be configurable to use number of blacks" do
774
774
  @t.tie_breaks = [:blacks]
775
775
  @t.rerank
776
- @t.player(2).rank.should == 1 # 3.0/2
777
- @t.player(1).rank.should == 2 # 3.0/1
778
- @t.player(4).rank.should == 3 # 1.0/2
779
- @t.player(3).rank.should == 4 # 1.0/1
780
- @t.player(6).rank.should == 5 # 0.5/2
781
- @t.player(5).rank.should == 6 # 0.5/1
776
+ expect(@t.player(2).rank).to eq(1) # 3.0/2
777
+ expect(@t.player(1).rank).to eq(2) # 3.0/1
778
+ expect(@t.player(4).rank).to eq(3) # 1.0/2
779
+ expect(@t.player(3).rank).to eq(4) # 1.0/1
780
+ expect(@t.player(6).rank).to eq(5) # 0.5/2
781
+ expect(@t.player(5).rank).to eq(6) # 0.5/1
782
782
  end
783
783
 
784
784
  it "should be configurable to use number of wins" do
785
785
  @t.tie_breaks = [:wins]
786
786
  @t.rerank
787
- @t.player(1).rank.should == 1 # 3.0/3/"Fi"
788
- @t.player(2).rank.should == 2 # 3.0/3/"Ka"
789
- @t.player(3).rank.should == 3 # 1.0/1/"Mic"
790
- @t.player(4).rank.should == 4 # 1.0/1/"Min"
791
- @t.player(6).rank.should == 5 # 0.5/0/"Orr"
792
- @t.player(5).rank.should == 6 # 0.5/0/"Ui"
787
+ expect(@t.player(1).rank).to eq(1) # 3.0/3/"Fi"
788
+ expect(@t.player(2).rank).to eq(2) # 3.0/3/"Ka"
789
+ expect(@t.player(3).rank).to eq(3) # 1.0/1/"Mic"
790
+ expect(@t.player(4).rank).to eq(4) # 1.0/1/"Min"
791
+ expect(@t.player(6).rank).to eq(5) # 0.5/0/"Orr"
792
+ expect(@t.player(5).rank).to eq(6) # 0.5/0/"Ui"
793
793
  end
794
794
 
795
795
  it "should exhibit equivalence between Neustadtl and Sonneborn-Berger" do
796
796
  @t.tie_breaks = ['Sonneborn-Berger']
797
797
  @t.rerank
798
- (1..6).inject(''){ |t,r| t << @t.player(r).rank.to_s }.should == '213465'
798
+ expect((1..6).inject(''){ |t,r| t << @t.player(r).rank.to_s }).to eq('213465')
799
799
  end
800
800
 
801
801
  it "should be able to use more than one method" do
802
802
  @t.tie_breaks = [:neustadtl, :buchholz]
803
803
  @t.rerank
804
- @t.player(2).rank.should == 1 # 3.0/2.5
805
- @t.player(1).rank.should == 2 # 3.0/2.0
806
- @t.player(3).rank.should == 3 # 1.0/1.0
807
- @t.player(4).rank.should == 4 # 1.0/0.5
808
- @t.player(5).rank.should == 5 # 0.5/0.25/6.5
809
- @t.player(6).rank.should == 6 # 0.5/0.25/4.5
804
+ expect(@t.player(2).rank).to eq(1) # 3.0/2.5
805
+ expect(@t.player(1).rank).to eq(2) # 3.0/2.0
806
+ expect(@t.player(3).rank).to eq(3) # 1.0/1.0
807
+ expect(@t.player(4).rank).to eq(4) # 1.0/0.5
808
+ expect(@t.player(5).rank).to eq(5) # 0.5/0.25/6.5
809
+ expect(@t.player(6).rank).to eq(6) # 0.5/0.25/4.5
810
810
  end
811
811
 
812
812
  it "should be possible as a side effect of validation" do
813
813
  @t.tie_breaks = [:buchholz]
814
- @t.invalid(:rerank => true).should be_false
815
- @t.player(2).rank.should == 1 # 3/3
816
- @t.player(1).rank.should == 2 # 3/2
817
- @t.player(3).rank.should == 3 # 1/7
818
- @t.player(4).rank.should == 4 # 1/4
819
- @t.player(5).rank.should == 5 # 1/6
820
- @t.player(6).rank.should == 6 # 0/5
814
+ expect(@t.invalid(:rerank => true)).to be_falsey
815
+ expect(@t.player(2).rank).to eq(1) # 3/3
816
+ expect(@t.player(1).rank).to eq(2) # 3/2
817
+ expect(@t.player(3).rank).to eq(3) # 1/7
818
+ expect(@t.player(4).rank).to eq(4) # 1/4
819
+ expect(@t.player(5).rank).to eq(5) # 1/6
820
+ expect(@t.player(6).rank).to eq(6) # 0/5
821
821
  end
822
822
 
823
823
  it "should be possible as a side effect of validation with multiple tie break methods" do
824
824
  @t.tie_breaks = [:neustadtl, :buchholz]
825
- @t.invalid(:rerank => true).should be_false
826
- @t.player(2).rank.should == 1 # 3/3
827
- @t.player(1).rank.should == 2 # 3/2
828
- @t.player(3).rank.should == 3 # 1/7
829
- @t.player(4).rank.should == 4 # 1/4
830
- @t.player(5).rank.should == 5 # 1/6
831
- @t.player(6).rank.should == 6 # 0/5
825
+ expect(@t.invalid(:rerank => true)).to be_falsey
826
+ expect(@t.player(2).rank).to eq(1) # 3/3
827
+ expect(@t.player(1).rank).to eq(2) # 3/2
828
+ expect(@t.player(3).rank).to eq(3) # 1/7
829
+ expect(@t.player(4).rank).to eq(4) # 1/4
830
+ expect(@t.player(5).rank).to eq(5) # 1/6
831
+ expect(@t.player(6).rank).to eq(6) # 0/5
832
832
  end
833
833
  end
834
834
 
@@ -840,49 +840,49 @@ EOS
840
840
 
841
841
  it "should parse a valid SwissPerfect file" do
842
842
  t = nil
843
- lambda { t = @c.parse_file!("#{@s}/sp/nccz.zip", 'SwissPerfect', :start => '2010-05-08') }.should_not raise_error
844
- t.players.size.should == 77
845
- t.start.should == '2010-05-08'
843
+ expect { t = @c.parse_file!("#{@s}/sp/nccz.zip", 'SwissPerfect', :start => '2010-05-08') }.not_to raise_error
844
+ expect(t.players.size).to eq(77)
845
+ expect(t.start).to eq('2010-05-08')
846
846
  end
847
847
 
848
848
  it "should parse a valid CSV file" do
849
849
  t = nil
850
- lambda { t = @c.parse_file!("#{@s}/fcsv/valid.csv", 'ForeignCSV') }.should_not raise_error
851
- t.players.size.should == 16
850
+ expect { t = @c.parse_file!("#{@s}/fcsv/valid.csv", 'ForeignCSV') }.not_to raise_error
851
+ expect(t.players.size).to eq(16)
852
852
  end
853
853
 
854
854
  it "should parse a valid Krause file" do
855
855
  t = nil
856
- lambda { t = @c.parse_file!("#{@s}/krause/valid.tab", 'Krause') }.should_not raise_error
857
- t.players.size.should == 12
856
+ expect { t = @c.parse_file!("#{@s}/krause/valid.tab", 'Krause') }.not_to raise_error
857
+ expect(t.players.size).to eq(12)
858
858
  end
859
859
 
860
860
  it "should ignore options where appropriate" do
861
861
  t = nil
862
- lambda { t = @c.parse_file!("#{@s}/krause/valid.tab", 'Krause', :start => '2010-05-08') }.should_not raise_error
863
- t.start.should == '2008-02-01'
862
+ expect { t = @c.parse_file!("#{@s}/krause/valid.tab", 'Krause', :start => '2010-05-08') }.not_to raise_error
863
+ expect(t.start).to eq('2008-02-01')
864
864
  end
865
865
 
866
866
  it "should raise exceptions for invalid files" do
867
- lambda { @c.parse_file!("#{@s}/sp/notenoughfiles.zip", 'SwissPerfect', :start => '2010-05-08') }.should raise_error(/files/)
868
- lambda { @c.parse_file!("#{@s}/krause/invalid.tab", 'Krause') }.should raise_error(/name/)
869
- lambda { @c.parse_file!("#{@s}/fcsv/invalid.csv", 'ForeignCSV') }.should raise_error(/termination/)
867
+ expect { @c.parse_file!("#{@s}/sp/notenoughfiles.zip", 'SwissPerfect', :start => '2010-05-08') }.to raise_error(/files/)
868
+ expect { @c.parse_file!("#{@s}/krause/invalid.tab", 'Krause') }.to raise_error(/name/)
869
+ expect { @c.parse_file!("#{@s}/fcsv/invalid.csv", 'ForeignCSV') }.to raise_error(/termination/)
870
870
  end
871
871
 
872
872
  it "should raise exceptions if the wrong type is used" do
873
- lambda { @c.parse_file!("#{@s}/krause/valid.tab", 'ForeignCSV') }.should raise_error(/expected/)
874
- lambda { @c.parse_file!("#{@s}/fcsv/valid.csv", 'SwissPerfect') }.should raise_error(/cannot/)
875
- lambda { @c.parse_file!("#{@s}/sp/nccz.zip", 'Krause') }.should raise_error(/(invalid|conversion)/i)
873
+ expect { @c.parse_file!("#{@s}/krause/valid.tab", 'ForeignCSV') }.to raise_error(/expected/)
874
+ expect { @c.parse_file!("#{@s}/fcsv/valid.csv", 'SwissPerfect') }.to raise_error(/cannot/)
875
+ expect { @c.parse_file!("#{@s}/sp/nccz.zip", 'Krause') }.to raise_error(/(invalid|conversion)/i)
876
876
  end
877
877
 
878
878
  it "should raise an exception if file does not exist" do
879
- lambda { @c.parse_file!("#{@s}/nosuchfile.cvs", 'ForeignCSV') }.should raise_error(/no such file/i)
880
- lambda { @c.parse_file!("#{@s}/nosuchfile.zip", 'SwissPerfect') }.should raise_error(/invalid/i)
881
- lambda { @c.parse_file!("#{@s}/nosuchfile.tab", 'Krause') }.should raise_error(/no such file/i)
879
+ expect { @c.parse_file!("#{@s}/nosuchfile.cvs", 'ForeignCSV') }.to raise_error(/no such file/i)
880
+ expect { @c.parse_file!("#{@s}/nosuchfile.zip", 'SwissPerfect') }.to raise_error(/invalid/i)
881
+ expect { @c.parse_file!("#{@s}/nosuchfile.tab", 'Krause') }.to raise_error(/no such file/i)
882
882
  end
883
883
 
884
884
  it "should raise an exception if an invalid type is used" do
885
- lambda { @c.parse_file!("#{@s}/krause/valid.tab", 'NoSuchType') }.should raise_error(/invalid format/i)
885
+ expect { @c.parse_file!("#{@s}/krause/valid.tab", 'NoSuchType') }.to raise_error(/invalid format/i)
886
886
  end
887
887
  end
888
888
 
@@ -898,12 +898,12 @@ EOS
898
898
  end
899
899
 
900
900
  it "should pass generic validation" do
901
- @t.invalid.should be_false
901
+ expect(@t.invalid).to be_falsey
902
902
  end
903
903
 
904
904
  it "should fail type-specific validation when the type supplied is inappropriate" do
905
- @t.invalid(:type => String).should match(/invalid type/)
906
- @t.invalid(:type => "AbCd").should match(/invalid type/)
905
+ expect(@t.invalid(:type => String)).to match(/invalid type/)
906
+ expect(@t.invalid(:type => "AbCd")).to match(/invalid type/)
907
907
  end
908
908
  end
909
909
  end