This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

wip

  • Loading branch information...
jasonm committed Nov 11, 2010
1 parent fe43005 commit 99b72a3999d63636487c2bd4799be078beebd08b
Showing with 29 additions and 0 deletions.
  1. +23 −0 features/rails.feature
  2. +6 −0 lib/hoptoad_notifier/rails/controller_methods.rb
View
@@ -237,3 +237,26 @@ Feature: Install the Gem in a Rails application
| session | value: test |
| parameters | param: value |
| url | http://example.com:123/test/index?param=value |
+
+ Scenario: Notify hoptoad within the controller using params filters
+ When I generate a new Rails application
+ And I configure the Hoptoad shim
+ And I configure my application to require the "hoptoad_notifier" gem
+ And I run the hoptoad generator with "-k myapikey"
+ And I configure the application to filter parameter "secret"
+ And I define a response for "TestController#index":
+ """
+ session[:value] = "test"
+ notify_hoptoad(RuntimeError.new("some message"))
+ render :nothing => true
+ """
+ And I route "/test/index" to "test#index"
+ And I perform a request to "http://example.com:123/test/index?secret=ccnumber"
+ Then I should receive the following Hoptoad notification:
+ | component | test |
+ | action | index |
+ | error message | RuntimeError: some message |
+ | error class | RuntimeError |
+ | session | value: test |
+ | parameters | secret: [FILTERED] |
+ | url | http://example.com:123/test/index?param=value |
@@ -32,8 +32,14 @@ def hoptoad_request_data
:action => params[:action],
:url => hoptoad_request_url,
:cgi_data => hoptoad_filter_if_filtering(request.env) }
+ # if rails3, use these instead:
+ # actionpack/lib/action_dispatch/http/request.rb
+ # actionpack/lib/action_dispatch/http/request.rb
+ # request.filtered_parameters
+ # request.filtered_env
end
+
def hoptoad_filter_if_filtering(hash)
return hash if ! hash.is_a?(Hash)

0 comments on commit 99b72a3

Please sign in to comment.