|
Revision 6998, 1.0 kB
(checked in by bitsweat, 2 years ago)
|
Remove deprecated find_first and find_all.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
require 'abstract_unit' |
|---|
| 2 |
require 'fixtures/entrant' |
|---|
| 3 |
|
|---|
| 4 |
class DeprecatedFinderTest < Test::Unit::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 |
|---|