2008-01-21 12:20:51 -05:00
|
|
|
require "cases/helper"
|
2008-01-18 02:31:37 -05:00
|
|
|
require 'models/entrant'
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2008-01-21 12:20:51 -05:00
|
|
|
class DeprecatedFinderTest < ActiveRecord::TestCase
|
2007-06-11 03:45:56 -04:00
|
|
|
fixtures :entrants
|
2005-03-22 19:56:13 -05:00
|
|
|
|
2007-06-11 03:45:56 -04:00
|
|
|
def test_deprecated_find_all_was_removed
|
|
|
|
assert_raise(NoMethodError) { Entrant.find_all }
|
2004-12-07 16:14:20 -05:00
|
|
|
end
|
|
|
|
|
2007-06-11 03:45:56 -04:00
|
|
|
def test_deprecated_find_first_was_removed
|
|
|
|
assert_raise(NoMethodError) { Entrant.find_first }
|
2004-12-07 16:14:20 -05:00
|
|
|
end
|
|
|
|
|
2007-06-11 03:45:56 -04:00
|
|
|
def test_deprecated_find_on_conditions_was_removed
|
|
|
|
assert_raise(NoMethodError) { Entrant.find_on_conditions }
|
2004-12-07 05:37:50 -05:00
|
|
|
end
|
2004-12-08 05:38:10 -05:00
|
|
|
|
2004-12-07 16:14:20 -05:00
|
|
|
def test_count
|
2006-09-26 13:02:45 -04:00
|
|
|
assert_equal(0, Entrant.count(:conditions => "id > 3"))
|
|
|
|
assert_equal(1, Entrant.count(:conditions => ["id > ?", 2]))
|
|
|
|
assert_equal(2, Entrant.count(:conditions => ["id > ?", 1]))
|
2004-12-07 16:14:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_count_by_sql
|
|
|
|
assert_equal(0, Entrant.count_by_sql("SELECT COUNT(*) FROM entrants WHERE id > 3"))
|
|
|
|
assert_equal(1, Entrant.count_by_sql(["SELECT COUNT(*) FROM entrants WHERE id > ?", 2]))
|
|
|
|
assert_equal(2, Entrant.count_by_sql(["SELECT COUNT(*) FROM entrants WHERE id > ?", 1]))
|
|
|
|
end
|
|
|
|
end
|