Skip to content
This repository
Browse code

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
  • Loading branch information...
commit a52132af587efa9bc9cefe3394499a681418c37e 1 parent f457ef4
David Heinemeier Hansson dhh authored
2  railties/CHANGELOG
... ... @@ -1,5 +1,7 @@
1 1 *SVN*
2 2
  3 +* Added demonstration of fixture use to the test case generated by the model generator [DHH]
  4 +
3 5 * If specified, pass PostgreSQL client character encoding to createdb. #2703 [Kazuhiko <kazuhiko@fdiary.net>]
4 6
5 7 * Catch CGI multipart parse errors. Wrap dispatcher internals in a failsafe response handler. [Jeremy Kemper]
4 railties/lib/rails_generator/generators/components/model/templates/fixtures.yml
... ... @@ -1,5 +1,5 @@
1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2   -first_<%= singular_name %>:
  2 +first:
3 3 id: 1
4   -another_<%= singular_name %>:
  4 +another:
5 5 id: 2
6 railties/lib/rails_generator/generators/components/model/templates/unit_test.rb
@@ -3,12 +3,8 @@
3 3 class <%= class_name %>Test < Test::Unit::TestCase
4 4 fixtures :<%= table_name %>
5 5
6   - def setup
7   - @<%= singular_name %> = <%= class_name %>.find(1)
8   - end
9   -
10 6 # Replace this with your real tests.
11 7 def test_truth
12   - assert_kind_of <%= class_name %>, @<%= singular_name %>
  8 + assert_kind_of <%= class_name %>, <%= table_name %>(:first)
13 9 end
14 10 end

0 comments on commit a52132a

Please sign in to comment.
Something went wrong with that request. Please try again.