Skip to content

Commit

Permalink
Changed the rake task so it can report different errors for testing p…
Browse files Browse the repository at this point in the history
…urposes.
  • Loading branch information
Jon Yurek committed Aug 5, 2008
1 parent f2d4f03 commit f4dcf5e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tasks/hoptoad_notifier_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace :hoptoad do
# This is to bypass any filters that may prevent access to the action.
prepend_before_filter :test_hoptoad
def test_hoptoad
puts 'Raising an error to simulate application failure.'
raise HoptoadTestingException, 'Testing hoptoad via "rake hoptoad:test". If you can see this, it works.'
puts "Raising '#{exception_class.name}' to simulate application failure."
raise exception_class.new, 'Testing hoptoad via "rake hoptoad:test". If you can see this, it works.'
end

def rescue_action exception
Expand All @@ -33,6 +33,13 @@ namespace :hoptoad do

# Ensure we actually have an action to go to.
def verify; end

def exception_class
exception_name = ENV['EXCEPTION'] || "HoptoadTestingException"
Object.const_get(exception_name)
rescue
Object.const_set(exception_name, Class.new(Exception))
end
end

puts 'Processing request.'
Expand Down

0 comments on commit f4dcf5e

Please sign in to comment.