Only one line of backtrace is displayed when I run:
rake test
Output:
...
ERROR should get search for keywords (1.93s)
NoMethodError: undefined method `features' for #<Transcript:0x00000006243780>
/usr/lib/ruby/gems/1.9.1/gems/activemodel-3.1.0/lib/active_model/attribute_methods.rb:385:in `method_missing'
...
I need more lines of backtrack information. I have tried
rake test --trace
Rails.backtrace_cleaner.remove_silencers!
in config/initializers/backtrace_silencers.rb
setting global $DEBUG=true
and it didn't work.
How can I turn it on?
To run a Minitest test, the only setup you really need is to require the autorun file at the beginning of a test file: require 'minitest/autorun' . This is good if you'd like to keep the code small. A better way to get started with Minitest is to have Bundler create a template project for you.
We can run all of our tests at once by using the bin/rails test command. Or we can run a single test file by passing the bin/rails test command the filename containing the test cases. This will run all test methods from the test case.
The stack trace (usually named "backtrace" in Ruby, but also referred to as "stack backtrace" and "stack traceback") is a human-readable representation of the stack at a specific moment while running your program.
Most methods can be tested by saying, “When I pass in argument X, I expect return value Y.” This one isn't so straightforward though. This is more like “When the user sees output X and then enters value V, expect subsequent output O.” Instead of accepting arguments, this method gets its value from user input.
BACKTRACE=blegga rake test
BACKTRACE=blegga rails test # rails 5+
Append --trace
if you need rake related log.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With