Sha256: 95f9e58ec969fe2b26cdb54eeb7942cf9cbde8860e06193ef542f564f511bcae

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

# encoding: utf-8

###
#  to run use
#     ruby -I ./lib -I ./test test/test_changes.rb

require 'helper'

class TestChanges < MiniTest::Test

  def test_score
    match1 = Match.new
    match1.score1 = 1
    match1.score2 = 2

    match2 = Match.new
    match2.score1   = 1
    match2.score2   = 1
    match2.score1p  = 5
    match2.score2p  = 3

    match_attribs = {
      score1: 1,
      score2: 2,
      score1et: nil,
      score2et: nil,
      score1p:  nil,
      score2p:  nil
    }

    assert_equal  false, match1.check_for_changes( match_attribs )
    assert_equal  true,  match2.check_for_changes( match_attribs )
  end

  def test_date
    match1 = Match.new
    match1.score1 = 1
    match1.score2 = 2
    match1.date   = Date.new( 2012, 11, 5 )

    match2 = Match.new
    match2.score1   = 1
    match2.score2   = 2
    match2.date     = DateTime.new( 2012, 12, 24 )

    match_attribs = {
      score1:  1,
      score2:  2,
      date: DateTime.new( 2012, 11, 5 )
    }

    assert_equal  false, match1.check_for_changes( match_attribs )
    assert_equal  true,  match2.check_for_changes( match_attribs )
  end

  def test_group_id
    match1 = Match.new
    match1.score1 = 1
    match1.score2 = 2
    match1.group_id = 1

    match2 = Match.new
    match2.score1   = 1
    match2.score2   = 2
    match2.group_id = 2

    match_attribs = {
      score1:  1,
      score2:  2,
      group_id: 1
    }

    assert_equal  false, match1.check_for_changes( match_attribs )
    assert_equal  true,  match2.check_for_changes( match_attribs )
  end


end # class TestChanges

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sportdb-models-2.0.3 test/test_changes.rb
sportdb-models-2.0.2 test/test_changes.rb
sportdb-models-2.0.1 test/test_changes.rb
sportdb-models-2.0.0 test/test_changes.rb