On 23 December 2010 17:40, Joshua S. <[email protected]> wrote: > Hi all, > > I'm new to Rails and new to Rails testing. I have a few questions: > > First, the most important question. How do I get line numbers to be > reported with my errors when testing. Here is what I get back on a > typical error: > > > j...@josh-laptop:~/d/test$ ruby unit/line_test.rb -n test_update > Loaded suite unit/line_test > Started > E > Finished in 0.066663 seconds. > > 1) Error: > test_update(LineTest): > NameError: undefined local variable or method `sdf' for > #<LineTest:0xb6e61304> > > > 1 tests, 0 assertions, 0 failures, 1 errors > > It is tough to debug without a line number and filename. From the code > samples I've seen, people generally get back a more verbose error > report. How do I enable this?
I suggest running from your app root. What happens if you do ruby -I test test/unit/line_test.rb > > The next question is a small one. What is the difference between: > -ruby unit/line_test.rb That will only work if you run from the test folder, in fact I am surprised it works at all as I don't know how it finds the app environment. > -ruby test -I unit/line_test.rb That should be '-I test' not 'test -I' . It tells it to Include the folder test in the search path, so that require 'test_helper' at the top of the test file finds test/test_helper.rb > -ruby test unit/line_test.rb I don't think this would ever work. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

