aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/testing.textile
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-02-09 13:50:08 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-02-09 13:50:08 -0800
commite0cba3a0fab28f96dc9b5d3a714886583873a7d3 (patch)
tree8712fd8f0b53b7916ae8549decb86928302f00dc /railties/guides/source/testing.textile
parent6c50c07d8dbb0b014e68608fe72f807cbe7f5c45 (diff)
parente6c98b83cbf4eab8944601754cc8d0e627b55d6f (diff)
downloadrails-e0cba3a0fab28f96dc9b5d3a714886583873a7d3.tar.gz
rails-e0cba3a0fab28f96dc9b5d3a714886583873a7d3.tar.bz2
rails-e0cba3a0fab28f96dc9b5d3a714886583873a7d3.zip
Merge branch 'master' into instance_reader
* master: (30 commits) Bump tzinfo. 0.3.31 was released on November 6, 2011. Fix GH #4909. Dependency on TZInfo move from AR to AS. moving ordered hash to normal hash because ruby 1.9.3 hash defaultly ordered one Refactored the OrderedHash related stuff Replaced OrderedHash usage with Ruby 1.9 Hash Replaced OrderedHash with Hash for ruby 1.9 series removed unnecessary code replacing the orderhash with hash for ruby-1.9 Clean up some wording. Fix typo. test title changed corresponding to the test replaced active support ordered hash to ruby hash on active resource PostgreSQL does not work in the same way of the other adapters AR::Relation#pluck: improve to work with joins Fix match docs Fix attribute_before_type_cast for serialized attributes. Fixes #4837. Fix failing request test Fixes in AMo README Update README to mention lint. Trim down Active Model API by removing valid? and errors.full_messages ...
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>