Froze rails gems
[depot.git] / vendor / rails / activerecord / test / cases / deprecated_finder_test.rb
1 require "cases/helper"
2 require 'models/entrant'
3
4 class DeprecatedFinderTest < ActiveRecord::TestCase
5 fixtures :entrants
6
7 def test_deprecated_find_all_was_removed
8 assert_raise(NoMethodError) { Entrant.find_all }
9 end
10
11 def test_deprecated_find_first_was_removed
12 assert_raise(NoMethodError) { Entrant.find_first }
13 end
14
15 def test_deprecated_find_on_conditions_was_removed
16 assert_raise(NoMethodError) { Entrant.find_on_conditions }
17 end
18
19 def test_count
20 assert_equal(0, Entrant.count(:conditions => "id > 3"))
21 assert_equal(1, Entrant.count(:conditions => ["id > ?", 2]))
22 assert_equal(2, Entrant.count(:conditions => ["id > ?", 1]))
23 end
24
25 def test_count_by_sql
26 assert_equal(0, Entrant.count_by_sql("SELECT COUNT(*) FROM entrants WHERE id > 3"))
27 assert_equal(1, Entrant.count_by_sql(["SELECT COUNT(*) FROM entrants WHERE id > ?", 2]))
28 assert_equal(2, Entrant.count_by_sql(["SELECT COUNT(*) FROM entrants WHERE id > ?", 1]))
29 end
30 end