2004-11-24 01:04:44 +00:00
|
|
|
require 'abstract_unit'
|
2004-12-07 21:14:20 +00:00
|
|
|
require 'fixtures/entrant'
|
2004-11-24 01:04:44 +00:00
|
|
|
|
2005-10-15 19:52:40 +00:00
|
|
|
class DeprecatedFinderTest < Test::Unit::TestCase
|
2007-06-11 07:45:56 +00:00
|
|
|
fixtures :entrants
|
2005-03-23 00:56:13 +00:00
|
|
|
|
2007-06-11 07:45:56 +00:00
|
|
|
def test_deprecated_find_all_was_removed
|
|
|
|
assert_raise(NoMethodError) { Entrant.find_all }
|
2004-12-07 21:14:20 +00:00
|
|
|
end
|
|
|
|
|
2007-06-11 07:45:56 +00:00
|
|
|
def test_deprecated_find_first_was_removed
|
|
|
|
assert_raise(NoMethodError) { Entrant.find_first }
|
2004-12-07 21:14:20 +00:00
|
|
|
end
|
|
|
|
|
2007-06-11 07:45:56 +00:00
|
|
|
def test_deprecated_find_on_conditions_was_removed
|
|
|
|
assert_raise(NoMethodError) { Entrant.find_on_conditions }
|
2004-12-07 10:37:50 +00:00
|
|
|
end
|
2004-12-08 10:38:10 +00:00
|
|
|
|
2004-12-07 21:14:20 +00:00
|
|
|
def test_count
|
2006-09-26 17:02:45 +00: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 21:14:20 +00: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
|