Skip to content

Instantly share code, notes, and snippets.

@samsm
Created April 29, 2013 15:16
Show Gist options
  • Save samsm/5482251 to your computer and use it in GitHub Desktop.
Save samsm/5482251 to your computer and use it in GitHub Desktop.
Shorten stack trace file names
1) Error:
test_0001_should generate form with method=get(integration search_form_for):
ArgumentError: wrong number of arguments (1 for 2)
/spec/minitest_helper.rb:68:in `block (3 levels) in formed_class'
/gems/actionpack-3.2.9/lib/action_dispatch/routing/polymorphic_routes.rb:129:in `polymorphic_url'
/gems/actionpack-3.2.9/lib/action_dispatch/routing/polymorphic_routes.rb:135:in `polymorphic_path'
/gems/actionpack-3.2.9/lib/action_view/helpers/form_helper.rb:397:in `apply_form_for_options!'
/gems/actionpack-3.2.9/lib/action_view/helpers/form_helper.rb:370:in `form_for'
/lib/mundane-search/view_helpers.rb:10:in `search_form_for'
/spec/search_form_for_integration_spec.rb:15:in `block (2 levels) in <top (required)>'
1) Error:
test_0001_should generate form with method=get(integration search_form_for):
ArgumentError: wrong number of arguments (1 for 2)
/Users/samsm/Repositories/mine/mundane-search/spec/minitest_helper.rb:68:in `block (3 levels) in formed_class'
/Users/samsm/.rvm/gems/ruby-1.9.3-p374@mundane-search/gems/actionpack-3.2.9/lib/action_dispatch/routing/polymorphic_routes.rb:129:in `polymorphic_url'
/Users/samsm/.rvm/gems/ruby-1.9.3-p374@mundane-search/gems/actionpack-3.2.9/lib/action_dispatch/routing/polymorphic_routes.rb:135:in `polymorphic_path'
/Users/samsm/.rvm/gems/ruby-1.9.3-p374@mundane-search/gems/actionpack-3.2.9/lib/action_view/helpers/form_helper.rb:397:in `apply_form_for_options!'
/Users/samsm/.rvm/gems/ruby-1.9.3-p374@mundane-search/gems/actionpack-3.2.9/lib/action_view/helpers/form_helper.rb:370:in `form_for'
/Users/samsm/Repositories/mine/mundane-search/lib/mundane-search/view_helpers.rb:10:in `search_form_for'
/Users/samsm/Repositories/mine/mundane-search/spec/search_form_for_integration_spec.rb:15:in `block (2 levels) in <top (required)>'
class AgressiveBacktraceFilter < Minitest::BacktraceFilter
def gem_paths
return @gem_paths if @gem_paths
raw_paths = `gem env gempath`
@gem_paths = raw_paths.split(':')
end
def project_path
@project_path ||= File.expand_path(File.dirname(__FILE__) + "/../")
end
def filter_paths
gem_paths + [project_path]
end
def filter(bt)
original_filter = super(bt)
original_filter.collect do |line|
filter_paths.inject(line) do |sum, path|
sum.sub(/\A#{path}/,'')
end
end
end
end
Minitest.backtrace_filter = AgressiveBacktraceFilter.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment