diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 15:31:20 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 15:31:20 +0000 |
commit | c1611a703c5366d7a85a5283ba1d721cfb5be43a (patch) | |
tree | 75445cc8710ded001a6307080a26421875508251 /activerecord/test/associations_test.rb | |
parent | 515886a5650bfa25e1c450dd31fd4922434a161c (diff) | |
download | rails-c1611a703c5366d7a85a5283ba1d721cfb5be43a.tar.gz rails-c1611a703c5366d7a85a5283ba1d721cfb5be43a.tar.bz2 rails-c1611a703c5366d7a85a5283ba1d721cfb5be43a.zip |
Updated documentation here and there
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1210 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-x | activerecord/test/associations_test.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 6cca750644..3f0fa1c0b6 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -317,8 +317,8 @@ class HasManyAssociationsTest < Test::Unit::TestCase def test_find_all firm = Firm.find_first assert_equal firm.clients, firm.clients.find_all - assert_equal 2, firm.clients.find_all("type = 'Client'").length - assert_equal 1, firm.clients.find_all("name = 'Summit'").length + assert_equal 2, firm.clients.find(:all, :conditions => "type = 'Client'").length + assert_equal 1, firm.clients.find(:all, :conditions => "name = 'Summit'").length end def test_find_all_sanitized @@ -682,7 +682,7 @@ class BelongsToAssociationsTest < Test::Unit::TestCase def test_field_name_same_as_foreign_key computer = Computer.find 1 - assert_not_nil computer.developer, ":foreign key == attribute didn't lock up" + assert_not_nil computer.developer, ":foreign key == attribute didn't lock up" # ' end def xtest_counter_cache @@ -705,12 +705,7 @@ end class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase - def setup - @accounts, @companies, @developers, @projects, @developers_projects = - create_fixtures "accounts", "companies", "developers", "projects", "developers_projects" - - @signals37 = Firm.find(1) - end + fixtures :accounts, :companies, :developers, :projects, :developers_projects def test_has_and_belongs_to_many david = Developer.find(1) @@ -914,4 +909,12 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase @active_record.developers.reload assert_equal @developers["david"].find, @active_record.developers.find(@developers["david"]["id"]), "Ruby find" end -end + + def xtest_find_in_association_with_options + developers = @active_record.developers.find(:all) + assert_equal 2, developers.size + + assert_equal @david, @active_record.developers.find(:first, :conditions => "salary < 10000") + assert_equal @jamis, @active_record.developers.find(:first, :order => "salary DESC") + end +end
\ No newline at end of file |