diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-02 10:15:31 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-02 10:15:31 +0000 |
commit | a52132af587efa9bc9cefe3394499a681418c37e (patch) | |
tree | 816021e6f5bc648dee79c34e09fd4c979701db9d /railties/lib | |
parent | f457ef46cfa5f7729ca95a2b2951c728d874fed4 (diff) | |
download | rails-a52132af587efa9bc9cefe3394499a681418c37e.tar.gz rails-a52132af587efa9bc9cefe3394499a681418c37e.tar.bz2 rails-a52132af587efa9bc9cefe3394499a681418c37e.zip |
Added demonstration of fixture use to the test case generated by the model generator [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2846 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails_generator/generators/components/model/templates/fixtures.yml | 4 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/model/templates/unit_test.rb | 6 |
2 files changed, 3 insertions, 7 deletions
diff --git a/railties/lib/rails_generator/generators/components/model/templates/fixtures.yml b/railties/lib/rails_generator/generators/components/model/templates/fixtures.yml index d29fcff2ff..8794d28ae4 100644 --- a/railties/lib/rails_generator/generators/components/model/templates/fixtures.yml +++ b/railties/lib/rails_generator/generators/components/model/templates/fixtures.yml @@ -1,5 +1,5 @@ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -first_<%= singular_name %>: +first: id: 1 -another_<%= singular_name %>: +another: id: 2 diff --git a/railties/lib/rails_generator/generators/components/model/templates/unit_test.rb b/railties/lib/rails_generator/generators/components/model/templates/unit_test.rb index e8714b589a..852b5d2529 100644 --- a/railties/lib/rails_generator/generators/components/model/templates/unit_test.rb +++ b/railties/lib/rails_generator/generators/components/model/templates/unit_test.rb @@ -3,12 +3,8 @@ require File.dirname(__FILE__) + '/../test_helper' class <%= class_name %>Test < Test::Unit::TestCase fixtures :<%= table_name %> - def setup - @<%= singular_name %> = <%= class_name %>.find(1) - end - # Replace this with your real tests. def test_truth - assert_kind_of <%= class_name %>, @<%= singular_name %> + assert_kind_of <%= class_name %>, <%= table_name %>(:first) end end |