Turn on full backtrace in Ruby on Rails TestCase
BACKTRACE=blegga rake test
BACKTRACE=blegga rails test # rails 5+
Append --trace
if you need rake related log.
How to get stack trace from a Test::Unit::TestCase
Looking through the code of Test::Unit in Ruby 1.8, it seems all the errors go through the Test::Unit::Error object which filters the backtrace in its #long_display method. There is no configuration and all runners will use the same filtered trace.
Brute force monkey patch to get the whole trace: (I put this in my single test case file; perhaps you could put it in a test helper)
require 'test/unit/util/backtracefilter'
module Test::Unit::Util::BacktraceFilter
def filter_backtrace(backtrace, prefix=nil)
backtrace
end
end
And monkey patch for Ruby 1.9 (which uses minitest)
def MiniTest.filter_backtrace(bt)
bt
end
How to disable rendering the view in ActionController TestCase (Rails 3.0.9)
I had the same problem of disabling just layout, while still rendering the main view. With rspec mocks this works for me:
@controller.stub(:layout).and_return(false)
I've never used rr, but I would imagine the syntax might be as follows:
stub(@controller).layout { false }
How to get rspec-2 to give the full trace associated with a test failure?
You must run rspec with -b
option to see full backtraces
Related Topics
Ruby Conditional-Assignment and Private Methods
Rails Devise - Current_User Is Nil
How to Change Passenger Ruby Version Without Recompiling
Ruby Refuses to Divide Correctly
Could Not Find Rake with Bundle Exec
Save Image with Mechanize and Nokogiri
Activerecords Select(:Id).Collect VS. Pluck(:Id) Methods: Why Is Pure Ar "Pluck" Slower
How to I Add a Hyperlink to a Cell in Axlsx
Saml 2.0 Sso for Ruby on Rails
Ruby on Rails: How to Use Oauth2::Accesstoken.Post
How to Connect to Browser Using Ruby Selenium Webdriver
Check If Array of Integers Increments in Ruby
Is Getting Converted as "\U0092" by Nokogiri in Ruby on Rails
What Are Symbols and How Do We Use Them