test/test_cursor.rb in sportdb-models-1.19.1 vs test/test_cursor.rb in sportdb-models-2.0.0
- old
+ new
@@ -7,45 +7,45 @@
require 'helper'
class TestCursor < MiniTest::Test
- def test_games
- games = []
+ def test_matches
+ matches = []
- games << Game.new( score1: 3, score2: 1, play_at: DateTime.new(2013, 8, 9) )
- games << Game.new( score1: 1, score2: 3, play_at: DateTime.new(2013, 8, 10) )
- games << Game.new( score1: 2, score2: 0, play_at: DateTime.new(2013, 8, 10) )
- games << Game.new( score1: 3, score2: 2, play_at: DateTime.new(2013, 8, 12) ) # new_week
+ matches << Match.new( score1: 3, score2: 1, date: Date.new(2013, 8, 9) )
+ matches << Match.new( score1: 1, score2: 3, date: Date.new(2013, 8, 10) )
+ matches << Match.new( score1: 2, score2: 0, date: Date.new(2013, 8, 10) )
+ matches << Match.new( score1: 3, score2: 2, date: Date.new(2013, 8, 12) ) # new_week
- GameCursor.new( games ).each do |game,state|
+ MatchCursor.new( matches ).each do |match,state|
if state.index == 0
- assert_equal 3, game.score1
- assert_equal 1, game.score2
+ assert_equal 3, match.score1
+ assert_equal 1, match.score2
assert_equal true, state.new_date?
assert_equal true, state.new_year?
assert_equal true, state.new_week?
end
if state.index == 1
- assert_equal 1, game.score1
- assert_equal 3, game.score2
+ assert_equal 1, match.score1
+ assert_equal 3, match.score2
assert_equal true, state.new_date?
assert_equal false, state.new_year?
assert_equal false, state.new_week?
end
if state.index == 2
- assert_equal 2, game.score1
- assert_equal 0, game.score2
+ assert_equal 2, match.score1
+ assert_equal 0, match.score2
assert_equal false, state.new_date?
assert_equal false, state.new_year?
assert_equal false, state.new_week?
end
if state.index == 3
- assert_equal 3, game.score1
- assert_equal 2, game.score2
+ assert_equal 3, match.score1
+ assert_equal 2, match.score2
assert_equal true, state.new_date?
assert_equal true, state.new_week?
assert_equal false, state.new_year?
end
end