aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStaphany Park <stapark008@gmail.com>2015-06-13 01:11:25 -0400
committerStaphany Park <stapark008@gmail.com>2015-06-13 01:11:25 -0400
commit3862c55049adc14efd8dc8bd4c4627e0b987d51c (patch)
tree198f04c1fd62809468e40e2ab60b38ac77c4f75a
parent335a2b8a40d6f1553a76328fd89fc90a93d8d234 (diff)
downloadrails-3862c55049adc14efd8dc8bd4c4627e0b987d51c.tar.gz
rails-3862c55049adc14efd8dc8bd4c4627e0b987d51c.tar.bz2
rails-3862c55049adc14efd8dc8bd4c4627e0b987d51c.zip
Add fixture use case to testing.md.
I think people would find it useful to know that you can pass in multiple fixture names to get an array of all the fixtures. I've found this useful in my own app. It looks like there already a test case that supports this feature (https://github.com/rails/rails/blob/master/activerecord/test/cases/fixtures_test.rb#L398), but it's just not documented here. I look forward to your feedback!
-rw-r--r--guides/source/testing.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md
index 230e8162f3..2fd54a48fc 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -141,6 +141,13 @@ users(:david).id
email(david.partner.email, david.location_tonight)
```
+To get multiple fixtures at once, you can pass in a list of fixture names. For example:
+
+```ruby
+# this will return an array containing the fixtures david and steve
+users(:david, :steve)
+```
+
### Console Tasks for Running your Tests
Rails comes with a CLI command to run tests.