Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow namespaced exceptions during rake hoptoad:test #10

Closed
wants to merge 1 commit into from

2 participants

@kristjan

Trying something like EXCEPTION=Foo::Bar::Baz rake hoptoad:test would fail with NameError: wrong constant name Foo::Bar::Baz. This commit allows for testing of namespaced exceptions, though it won't create them in the event that they're missing.

@jyurek
Owner

I'm unsure of why this is useful. Do you often need to do hoptoad tests with namespaced exceptions?

@kristjan

I believe I had added a namespaced exception to the ignore list and wanted to verify that I had done it properly. I don't often need to do Hoptoad tests in general, but figured if I ran into this, someone else probably would too.

@jyurek
Owner

I think testing the ignores is a valid enough case that we can pull this in. Thanks!

@jyurek jyurek closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 22, 2010
  1. Allow namespaced exceptions in rake hoptoad:test

    Kristján Pétursson authored
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/hoptoad_notifier/tasks.rb
View
6 lib/hoptoad_notifier/tasks.rb
@@ -4,7 +4,7 @@
desc "Notify Hoptoad of a new deploy."
task :deploy => :environment do
require 'hoptoad_tasks'
- HoptoadTasks.deploy(:rails_env => ENV['TO'],
+ HoptoadTasks.deploy(:rails_env => ENV['TO'],
:scm_revision => ENV['REVISION'],
:scm_repository => ENV['REPO'],
:local_username => ENV['USER'],
@@ -77,7 +77,9 @@ def local_request?
def exception_class
exception_name = ENV['EXCEPTION'] || "HoptoadTestingException"
- Object.const_get(exception_name)
+ klass = Object
+ exception_name.split("::").each{|o| klass = klass.const_get(o)}
+ klass
rescue
Object.const_set(exception_name, Class.new(Exception))
end
Something went wrong with that request. Please try again.