Skip to content

Commit

Permalink
Fixed bug related to refactoring of #ignore=, added InvalidAuthentici…
Browse files Browse the repository at this point in the history
…tyToken error as a default ignored error class.

git-svn-id: https://svn.thoughtbot.com/plugins/hoptoad_notifier/trunk@436 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information
emill committed Apr 4, 2008
1 parent a55ec31 commit d6ca96c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions README
Expand Up @@ -76,6 +76,7 @@ notifications (when #notify is called directly).
Hoptoad ignores the following exceptions by default:
ActiveRecord::RecordNotFound
CGI::Session::CookieStore::TamperedWithCookie
ActionController::InvalidAuthenticityToken

To ignore errors in addition to those, specify their names in your Hoptoad
configuration block.
Expand Down
4 changes: 2 additions & 2 deletions lib/hoptoad_notifier.rb
Expand Up @@ -3,7 +3,7 @@
# Plugin for applications to automatically post errors to the Hoptoad of their choice.
module HoptoadNotifier

IGNORE_DEFAULT = [ActiveRecord::RecordNotFound, CGI::Session::CookieStore::TamperedWithCookie]
IGNORE_DEFAULT = [ActiveRecord::RecordNotFound, CGI::Session::CookieStore::TamperedWithCookie, ActionController::InvalidAuthenticityToken]

class << self
attr_accessor :host, :port, :secure, :project_name, :filter_params, :ignore
Expand All @@ -29,7 +29,7 @@ def ignore

# Adds an error to the list of what gets ignored.
def ignore=(names)
@ignore += names
@ignore = self.ignore + names
end

# Sets the list of ignored errors to only what is passed in here. This method
Expand Down
4 changes: 3 additions & 1 deletion test/hoptoad_notifier_test.rb
Expand Up @@ -46,7 +46,7 @@ def manual_notify_ignored
end

class HoptoadNotifierTest < Test::Unit::TestCase
def request action = nil, method = :get
def request(action = nil, method = :get)
@request = ActionController::TestRequest.new({
"controller" => "hoptoad",
"action" => action ? action.to_s : "",
Expand Down Expand Up @@ -74,12 +74,14 @@ def rescue_action e
config.port = 3333
config.secure = true
config.project_name = "bob"
config.ignore = [RuntimeError]
end

assert_equal "host", HoptoadNotifier.host
assert_equal 3333, HoptoadNotifier.port
assert_equal true, HoptoadNotifier.secure
assert_equal "bob", HoptoadNotifier.project_name
assert_equal HoptoadNotifier::IGNORE_DEFAULT + [RuntimeError], HoptoadNotifier.ignore
end

should "add filters to the backtrace_filters" do
Expand Down

0 comments on commit d6ca96c

Please sign in to comment.