提交 62c6ac2f 编写于 作者: J Jon Leighton

quarantine more deprecated stuff

上级 ee16feae
......@@ -168,24 +168,6 @@ def test_table_exists
assert Topic.table_exists?
end
def test_finder_block
t = Topic.first
found = nil
Topic.find_by_id(t.id) { |f| found = f }
assert_equal t, found
end
def test_finder_block_nothing_found
bad_id = Topic.maximum(:id) + 1
assert_nil Topic.find_by_id(bad_id) { |f| raise }
end
def test_find_returns_block_value
t = Topic.first
x = Topic.find_by_id(t.id) { |f| "hi mom!" }
assert_equal "hi mom!", x
end
def test_preserving_date_objects
if current_adapter?(:SybaseAdapter)
# Sybase ctlib does not (yet?) support the date type; use datetime instead.
......
......@@ -525,6 +525,42 @@ def test_dynamic_find_or_create_by_attributes_bang
assert_equal authors(:david), authors.find_or_create_by_name!(:name => 'David')
end
def test_finder_block
t = Topic.first
found = nil
Topic.find_by_id(t.id) { |f| found = f }
assert_equal t, found
end
def test_finder_block_nothing_found
bad_id = Topic.maximum(:id) + 1
assert_nil Topic.find_by_id(bad_id) { |f| raise }
end
def test_find_returns_block_value
t = Topic.first
x = Topic.find_by_id(t.id) { |f| "hi mom!" }
assert_equal "hi mom!", x
end
def test_dynamic_finder_with_invalid_params
assert_raise(ArgumentError) { Topic.find_by_title 'No Title', :join => "It should be `joins'" }
end
def test_find_by_one_attribute_with_order_option
assert_equal accounts(:signals37), Account.find_by_credit_limit(50, :order => 'id')
assert_equal accounts(:rails_core_account), Account.find_by_credit_limit(50, :order => 'id DESC')
end
def test_dynamic_find_by_attributes_should_yield_found_object
david = authors(:david)
yielded_value = nil
Author.find_by_name(david.name) do |author|
yielded_value = author
end
assert_equal david, yielded_value
end
end
class DynamicScopeTest < ActiveRecord::TestCase
......
......@@ -589,11 +589,6 @@ def test_find_by_one_attribute_bang
assert_raise(ActiveRecord::RecordNotFound) { Topic.find_by_title!("The First Topic!") }
end
def test_find_by_one_attribute_with_order_option
assert_equal accounts(:signals37), Account.find_by_credit_limit(50, :order => 'id')
assert_equal accounts(:rails_core_account), Account.find_by_credit_limit(50, :order => 'id DESC')
end
def test_find_by_one_attribute_with_conditions
assert_equal accounts(:rails_core_account), Account.where('firm_id = ?', 6).find_by_credit_limit(50)
end
......@@ -678,10 +673,6 @@ def test_find_with_bad_sql
assert_raise(ActiveRecord::StatementInvalid) { Topic.find_by_sql "select 1 from badtable" }
end
def test_dynamic_finder_with_invalid_params
assert_raise(ArgumentError) { Topic.find_by_title 'No Title', :join => "It should be `joins'" }
end
def test_find_all_with_join
developers_on_project_one = Developer.scoped(
:joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id',
......
......@@ -443,15 +443,6 @@ def test_loading_with_one_association_with_non_preload
assert_equal Post.find(1).last_comment, post.last_comment
end
def test_dynamic_find_by_attributes_should_yield_found_object
david = authors(:david)
yielded_value = nil
Author.find_by_name(david.name) do |author|
yielded_value = author
end
assert_equal david, yielded_value
end
def test_dynamic_find_by_attributes
david = authors(:david)
author = Author.preload(:taggings).find_by_id(david.id)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册