Skip to content
  • Jonathan Hefner's avatar
    33fdae05
    Fix backtraces for generated plugin tests · 33fdae05
    Jonathan Hefner authored
    `Minitest.plugin_rails_init` sets `Minitest.backtrace_filter` to
    `Rails.backtrace_cleaner` right before tests are run, overwriting the
    value set in test_helper.rb.
    
    `Rails.backtrace_cleaner` silences backtrace lines that do not start
    with `Rails.root` followed by e.g. "lib/" or "test/".  Thus when
    `Rails.root` is a subdirectory of the project directory -- for example,
    when testing a plugin that has a dummy app -- all lines of the backtrace
    are silenced.
    
    This commit adds a fallback such that when all backtrace lines are
    silenced, the original `Minitest.backtrace_filter` is used instead.
    
    Additionally, this commit refactors and expands existing test coverage.
    33fdae05
    Fix backtraces for generated plugin tests
    Jonathan Hefner authored
    `Minitest.plugin_rails_init` sets `Minitest.backtrace_filter` to
    `Rails.backtrace_cleaner` right before tests are run, overwriting the
    value set in test_helper.rb.
    
    `Rails.backtrace_cleaner` silences backtrace lines that do not start
    with `Rails.root` followed by e.g. "lib/" or "test/".  Thus when
    `Rails.root` is a subdirectory of the project directory -- for example,
    when testing a plugin that has a dummy app -- all lines of the backtrace
    are silenced.
    
    This commit adds a fallback such that when all backtrace lines are
    silenced, the original `Minitest.backtrace_filter` is used instead.
    
    Additionally, this commit refactors and expands existing test coverage.
Loading