script/generate model creates wrong unit test file
Reported by Anil | May 18th, 2008 @ 05:14 AM
For latest edge Rails(Edge Rails revision 2463e38efd3cbcc10e7b0a93ad9c2d2224340668). When you generate model with "script/generate model user"
The file user_test.rb created in test/unit folder do not have line
require File.dirname(__FILE__) + '/../test_helper'
ruby 'test-helper'
which is wrong and so test fail until you make it correct.
Comments and changes to this ticket
-
DHH May 31st, 2008 @ 10:10 PM
- → State changed from new to incomplete
The new approach is to use "ruby -I test user_test.rb".
-
-
DHH June 6th, 2008 @ 05:21 AM
No, rake does the right thing. The -I is only needed when you run one-off with ruby alone.
-
shuber June 6th, 2008 @ 06:46 AM
I've been changing the require calls back to
require File.dirname(__FILE__) + '/../test_helper'so that I can still run the tests with TextMate's RubyMate
+1
-
Chris Cherry June 6th, 2008 @ 07:12 AM
This has been annoying me as well. This change doesn't alter other behavior, and allows the running of tests in TextMate!
+1
-
Jeremy Kemper June 6th, 2008 @ 08:31 AM
- → State changed from incomplete to invalid
Fix TM to pass -Itest or use the rake test task.
-
Aliaksey Kandratsenka June 24th, 2008 @ 03:24 PM
In comment to http://github.com/rails/rails/co...
i proposed changing header to:
($: << File.expand_path(File.join(File.dirname(FILE), ".."))).uniq!
require ‘test_helper’
Another option is to generate full path to test_helper.rb and then #require it.
How about this ? I really hate creating separate emacs command to lauch tests.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
