Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@dhh dhh authored
View
2  railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added demonstration of fixture use to the test case generated by the model generator [DHH]
+
* If specified, pass PostgreSQL client character encoding to createdb. #2703 [Kazuhiko <kazuhiko@fdiary.net>]
* Catch CGI multipart parse errors. Wrap dispatcher internals in a failsafe response handler. [Jeremy Kemper]
View
4 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
View
6 railties/lib/rails_generator/generators/components/model/templates/unit_test.rb
@@ -3,12 +3,8 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.