diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-06-07 10:05:23 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-06-07 10:05:23 +0000 |
commit | b9ea1d3384ceb5c52f311089776d126b2383105a (patch) | |
tree | b613e63fa1a881e5d8f792ab29e6a4795ec9fcc1 /guides | |
parent | ad539dcb30742c019e008ccc571bfeff77e8b24c (diff) | |
parent | 69107a72965be89200677986153e0a6820304584 (diff) | |
download | rails-b9ea1d3384ceb5c52f311089776d126b2383105a.tar.gz rails-b9ea1d3384ceb5c52f311089776d126b2383105a.tar.bz2 rails-b9ea1d3384ceb5c52f311089776d126b2383105a.zip |
Merge branch 'master' of github.com:rails/docrails
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/testing.md | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md index bac4b63c75..c01b2e575a 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -49,7 +49,9 @@ The `test_helper.rb` file holds the default configuration for your tests. ### The Low-Down on Fixtures -For good tests, you'll need to give some thought to setting up test data. In Rails, you can handle this by defining and customizing fixtures. +For good tests, you'll need to give some thought to setting up test data. +In Rails, you can handle this by defining and customizing fixtures. +You can find comprehensive documentation in the [fixture api documentation](http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html). #### What Are Fixtures? @@ -94,6 +96,12 @@ one: category: about ``` +Note: For associations to reference one another by name, you cannot specify the `id:` + attribute on the fixtures. Rails will auto assign a primary key to be consistent between + runs. If you manually specify an `id:` attribute, this behavior will not work. For more + information on this assocation behavior please read the + [fixture api documentation](http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html). + #### ERB'in It Up ERB allows you to embed Ruby code within templates. The YAML fixture format is pre-processed with ERB when Rails loads fixtures. This allows you to use Ruby to help you generate some sample data. For example, the following code generates a thousand users: |