aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/testing.textile
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-02-09 23:44:17 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-02-09 23:44:17 +0530
commite6c98b83cbf4eab8944601754cc8d0e627b55d6f (patch)
treedfab846ff415e071f9368d9d5fa1036d2c8cb1c6 /railties/guides/source/testing.textile
parenta8c150e0df0cba1cd766e6fe3828926d9f3eb7f3 (diff)
parentb0a39d9feb412777e4f3a0199f07713ef4e343c9 (diff)
downloadrails-e6c98b83cbf4eab8944601754cc8d0e627b55d6f.tar.gz
rails-e6c98b83cbf4eab8944601754cc8d0e627b55d6f.tar.bz2
rails-e6c98b83cbf4eab8944601754cc8d0e627b55d6f.zip
Merge branch 'master' of github.com:lifo/docrails
Conflicts: activerecord/lib/active_record/relation/query_methods.rb
Diffstat (limited to 'railties/guides/source/testing.textile')
-rw-r--r--railties/guides/source/testing.textile15
1 files changed, 4 insertions, 11 deletions
diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile
index e0386b95b4..1e6b92f45c 100644
--- a/railties/guides/source/testing.textile
+++ b/railties/guides/source/testing.textile
@@ -114,25 +114,18 @@ Rails by default automatically loads all fixtures from the +test/fixtures+ folde
* Load the fixture data into the table
* Dump the fixture data into a variable in case you want to access it directly
-h5. Hashes with Special Powers
+h5. Fixtures are ActiveRecord objects
-Fixtures are basically Hash objects. As mentioned in point #3 above, you can access the hash object directly because it is automatically setup as a local variable of the test case. For example:
+Fixtures are instances of ActiveRecord. As mentioned in point #3 above, you can access the object directly because it is automatically setup as a local variable of the test case. For example:
<ruby>
-# this will return the Hash for the fixture named david
+# this will return the User object for the fixture named david
users(:david)
# this will return the property for david called id
users(:david).id
-</ruby>
-
-Fixtures can also transform themselves into the form of the original class. Thus, you can get at the methods only available to that class.
-
-<ruby>
-# using the find method, we grab the "real" david as a User
-david = users(:david).find
-# and now we have access to methods only available to a User class
+# one can also access methods available on the User class
email(david.girlfriend.email, david.location_tonight)
</ruby>