From 3862c55049adc14efd8dc8bd4c4627e0b987d51c Mon Sep 17 00:00:00 2001 From: Staphany Park Date: Sat, 13 Jun 2015 01:11:25 -0400 Subject: 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! --- guides/source/testing.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'guides') 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. -- cgit v1.2.3