exception_notification 4.4.3 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Appraisals +1 -1
 - data/CHANGELOG.rdoc +13 -0
 - data/Gemfile.lock +352 -0
 - data/README.md +99 -46
 - data/docs/notifiers/slack.md +0 -7
 - data/exception_notification.gemspec +7 -7
 - data/gemfiles/{rails5_0.gemfile → rails6_1.gemfile} +1 -1
 - data/gemfiles/{rails4_2.gemfile → rails7_0.gemfile} +1 -1
 - data/lib/exception_notification/rails/runner_tie.rb +31 -0
 - data/lib/exception_notification/rails.rb +16 -0
 - data/lib/exception_notification/rake.rb +60 -0
 - data/lib/exception_notification/version.rb +1 -1
 - data/lib/exception_notifier/email_notifier.rb +1 -1
 - data/lib/exception_notifier/modules/error_grouping.rb +1 -0
 - data/lib/exception_notifier/modules/formatter.rb +5 -1
 - data/lib/exception_notifier/slack_notifier.rb +3 -0
 - data/lib/exception_notifier/sns_notifier.rb +3 -0
 - data/lib/exception_notifier/teams_notifier.rb +9 -6
 - data/lib/exception_notifier/views/exception_notifier/_data.html.erb +1 -1
 - data/lib/exception_notifier/views/exception_notifier/_data.text.erb +1 -1
 - data/lib/exception_notifier/views/exception_notifier/_session.html.erb +1 -1
 - data/lib/exception_notifier/views/exception_notifier/_session.text.erb +1 -1
 - data/lib/exception_notifier.rb +0 -1
 - data/lib/generators/exception_notification/install_generator.rb +1 -1
 - data/lib/generators/exception_notification/templates/exception_notification.rb.erb +3 -1
 - data/test/exception_notification/rake_test.rb +38 -0
 - data/test/exception_notifier/email_notifier_test.rb +8 -12
 - data/test/exception_notifier/hipchat_notifier_test.rb +1 -7
 - data/test/exception_notifier/sidekiq_test.rb +5 -1
 - data/test/exception_notifier/sns_notifier_test.rb +55 -0
 - metadata +46 -53
 - data/examples/sample_app.rb +0 -56
 - data/examples/sinatra/Gemfile +0 -10
 - data/examples/sinatra/Gemfile.lock +0 -95
 - data/examples/sinatra/Procfile +0 -2
 - data/examples/sinatra/README.md +0 -11
 - data/examples/sinatra/config.ru +0 -5
 - data/examples/sinatra/sinatra_app.rb +0 -40
 - data/gemfiles/rails4_0.gemfile +0 -7
 - data/gemfiles/rails4_1.gemfile +0 -7
 - data/gemfiles/rails5_1.gemfile +0 -7
 - data/lib/exception_notifier/campfire_notifier.rb +0 -41
 - data/test/exception_notifier/campfire_notifier_test.rb +0 -127
 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: exception_notification
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 4.6.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jamis Buck
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Josh Peek
         
     | 
| 
       9 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2025-03-21 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: actionmailer
         
     | 
| 
         @@ -17,40 +17,40 @@ dependencies: 
     | 
|
| 
       17 
17 
     | 
    
         
             
                requirements:
         
     | 
| 
       18 
18 
     | 
    
         
             
                - - ">="
         
     | 
| 
       19 
19 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       20 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 20 
     | 
    
         
            +
                    version: '5.2'
         
     | 
| 
       21 
21 
     | 
    
         
             
                - - "<"
         
     | 
| 
       22 
22 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       23 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 23 
     | 
    
         
            +
                    version: '9'
         
     | 
| 
       24 
24 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       25 
25 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       26 
26 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       27 
27 
     | 
    
         
             
                requirements:
         
     | 
| 
       28 
28 
     | 
    
         
             
                - - ">="
         
     | 
| 
       29 
29 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       30 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 30 
     | 
    
         
            +
                    version: '5.2'
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - "<"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '9'
         
     | 
| 
       34 
34 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       35 
35 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       36 
36 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - ">="
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '5.2'
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - "<"
         
     | 
| 
       42 
42 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       43 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 43 
     | 
    
         
            +
                    version: '9'
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
46 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       47 
47 
     | 
    
         
             
                requirements:
         
     | 
| 
       48 
48 
     | 
    
         
             
                - - ">="
         
     | 
| 
       49 
49 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       50 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 50 
     | 
    
         
            +
                    version: '5.2'
         
     | 
| 
       51 
51 
     | 
    
         
             
                - - "<"
         
     | 
| 
       52 
52 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 53 
     | 
    
         
            +
                    version: '9'
         
     | 
| 
       54 
54 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       55 
55 
     | 
    
         
             
              name: appraisal
         
     | 
| 
       56 
56 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -177,26 +177,40 @@ dependencies: 
     | 
|
| 
       177 
177 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       178 
178 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       179 
179 
     | 
    
         
             
                    version: 0.19.0
         
     | 
| 
      
 180 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 181 
     | 
    
         
            +
              name: net-smtp
         
     | 
| 
      
 182 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 183 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 184 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 185 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 186 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 187 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 188 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 189 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 190 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 191 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 192 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 193 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       180 
194 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       181 
195 
     | 
    
         
             
              name: rails
         
     | 
| 
       182 
196 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       183 
197 
     | 
    
         
             
                requirements:
         
     | 
| 
       184 
198 
     | 
    
         
             
                - - ">="
         
     | 
| 
       185 
199 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       186 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 200 
     | 
    
         
            +
                    version: '5.2'
         
     | 
| 
       187 
201 
     | 
    
         
             
                - - "<"
         
     | 
| 
       188 
202 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       189 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 203 
     | 
    
         
            +
                    version: '9'
         
     | 
| 
       190 
204 
     | 
    
         
             
              type: :development
         
     | 
| 
       191 
205 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       192 
206 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       193 
207 
     | 
    
         
             
                requirements:
         
     | 
| 
       194 
208 
     | 
    
         
             
                - - ">="
         
     | 
| 
       195 
209 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       196 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 210 
     | 
    
         
            +
                    version: '5.2'
         
     | 
| 
       197 
211 
     | 
    
         
             
                - - "<"
         
     | 
| 
       198 
212 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       199 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 213 
     | 
    
         
            +
                    version: '9'
         
     | 
| 
       200 
214 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       201 
215 
     | 
    
         
             
              name: resque
         
     | 
| 
       202 
216 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -215,16 +229,16 @@ dependencies: 
     | 
|
| 
       215 
229 
     | 
    
         
             
              name: rubocop
         
     | 
| 
       216 
230 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       217 
231 
     | 
    
         
             
                requirements:
         
     | 
| 
       218 
     | 
    
         
            -
                - -  
     | 
| 
      
 232 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       219 
233 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       220 
     | 
    
         
            -
                    version: 0 
     | 
| 
      
 234 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       221 
235 
     | 
    
         
             
              type: :development
         
     | 
| 
       222 
236 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       223 
237 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       224 
238 
     | 
    
         
             
                requirements:
         
     | 
| 
       225 
     | 
    
         
            -
                - -  
     | 
| 
      
 239 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       226 
240 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       227 
     | 
    
         
            -
                    version: 0 
     | 
| 
      
 241 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       228 
242 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       229 
243 
     | 
    
         
             
              name: sidekiq
         
     | 
| 
       230 
244 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -267,21 +281,7 @@ dependencies: 
     | 
|
| 
       267 
281 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       268 
282 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       269 
283 
     | 
    
         
             
                    version: 0.9.0
         
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
              name: tinder
         
     | 
| 
       272 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       273 
     | 
    
         
            -
                requirements:
         
     | 
| 
       274 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       275 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       276 
     | 
    
         
            -
                    version: '1.8'
         
     | 
| 
       277 
     | 
    
         
            -
              type: :development
         
     | 
| 
       278 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       279 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       280 
     | 
    
         
            -
                requirements:
         
     | 
| 
       281 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       282 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       283 
     | 
    
         
            -
                    version: '1.8'
         
     | 
| 
       284 
     | 
    
         
            -
            description: 
         
     | 
| 
      
 284 
     | 
    
         
            +
            description:
         
     | 
| 
       285 
285 
     | 
    
         
             
            email: smartinez87@gmail.com
         
     | 
| 
       286 
286 
     | 
    
         
             
            executables: []
         
     | 
| 
       287 
287 
     | 
    
         
             
            extensions: []
         
     | 
| 
         @@ -292,6 +292,7 @@ files: 
     | 
|
| 
       292 
292 
     | 
    
         
             
            - CODE_OF_CONDUCT.md
         
     | 
| 
       293 
293 
     | 
    
         
             
            - CONTRIBUTING.md
         
     | 
| 
       294 
294 
     | 
    
         
             
            - Gemfile
         
     | 
| 
      
 295 
     | 
    
         
            +
            - Gemfile.lock
         
     | 
| 
       295 
296 
     | 
    
         
             
            - MIT-LICENSE
         
     | 
| 
       296 
297 
     | 
    
         
             
            - README.md
         
     | 
| 
       297 
298 
     | 
    
         
             
            - Rakefile
         
     | 
| 
         @@ -307,30 +308,21 @@ files: 
     | 
|
| 
       307 
308 
     | 
    
         
             
            - docs/notifiers/sns.md
         
     | 
| 
       308 
309 
     | 
    
         
             
            - docs/notifiers/teams.md
         
     | 
| 
       309 
310 
     | 
    
         
             
            - docs/notifiers/webhook.md
         
     | 
| 
       310 
     | 
    
         
            -
            - examples/sample_app.rb
         
     | 
| 
       311 
     | 
    
         
            -
            - examples/sinatra/Gemfile
         
     | 
| 
       312 
     | 
    
         
            -
            - examples/sinatra/Gemfile.lock
         
     | 
| 
       313 
     | 
    
         
            -
            - examples/sinatra/Procfile
         
     | 
| 
       314 
     | 
    
         
            -
            - examples/sinatra/README.md
         
     | 
| 
       315 
     | 
    
         
            -
            - examples/sinatra/config.ru
         
     | 
| 
       316 
     | 
    
         
            -
            - examples/sinatra/sinatra_app.rb
         
     | 
| 
       317 
311 
     | 
    
         
             
            - exception_notification.gemspec
         
     | 
| 
       318 
     | 
    
         
            -
            - gemfiles/rails4_0.gemfile
         
     | 
| 
       319 
     | 
    
         
            -
            - gemfiles/rails4_1.gemfile
         
     | 
| 
       320 
     | 
    
         
            -
            - gemfiles/rails4_2.gemfile
         
     | 
| 
       321 
     | 
    
         
            -
            - gemfiles/rails5_0.gemfile
         
     | 
| 
       322 
     | 
    
         
            -
            - gemfiles/rails5_1.gemfile
         
     | 
| 
       323 
312 
     | 
    
         
             
            - gemfiles/rails5_2.gemfile
         
     | 
| 
       324 
313 
     | 
    
         
             
            - gemfiles/rails6_0.gemfile
         
     | 
| 
      
 314 
     | 
    
         
            +
            - gemfiles/rails6_1.gemfile
         
     | 
| 
      
 315 
     | 
    
         
            +
            - gemfiles/rails7_0.gemfile
         
     | 
| 
       325 
316 
     | 
    
         
             
            - lib/exception_notification.rb
         
     | 
| 
       326 
317 
     | 
    
         
             
            - lib/exception_notification/rack.rb
         
     | 
| 
       327 
318 
     | 
    
         
             
            - lib/exception_notification/rails.rb
         
     | 
| 
      
 319 
     | 
    
         
            +
            - lib/exception_notification/rails/runner_tie.rb
         
     | 
| 
      
 320 
     | 
    
         
            +
            - lib/exception_notification/rake.rb
         
     | 
| 
       328 
321 
     | 
    
         
             
            - lib/exception_notification/resque.rb
         
     | 
| 
       329 
322 
     | 
    
         
             
            - lib/exception_notification/sidekiq.rb
         
     | 
| 
       330 
323 
     | 
    
         
             
            - lib/exception_notification/version.rb
         
     | 
| 
       331 
324 
     | 
    
         
             
            - lib/exception_notifier.rb
         
     | 
| 
       332 
325 
     | 
    
         
             
            - lib/exception_notifier/base_notifier.rb
         
     | 
| 
       333 
     | 
    
         
            -
            - lib/exception_notifier/campfire_notifier.rb
         
     | 
| 
       334 
326 
     | 
    
         
             
            - lib/exception_notifier/datadog_notifier.rb
         
     | 
| 
       335 
327 
     | 
    
         
             
            - lib/exception_notifier/email_notifier.rb
         
     | 
| 
       336 
328 
     | 
    
         
             
            - lib/exception_notifier/google_chat_notifier.rb
         
     | 
| 
         @@ -364,8 +356,8 @@ files: 
     | 
|
| 
       364 
356 
     | 
    
         
             
            - lib/generators/exception_notification/install_generator.rb
         
     | 
| 
       365 
357 
     | 
    
         
             
            - lib/generators/exception_notification/templates/exception_notification.rb.erb
         
     | 
| 
       366 
358 
     | 
    
         
             
            - test/exception_notification/rack_test.rb
         
     | 
| 
      
 359 
     | 
    
         
            +
            - test/exception_notification/rake_test.rb
         
     | 
| 
       367 
360 
     | 
    
         
             
            - test/exception_notification/resque_test.rb
         
     | 
| 
       368 
     | 
    
         
            -
            - test/exception_notifier/campfire_notifier_test.rb
         
     | 
| 
       369 
361 
     | 
    
         
             
            - test/exception_notifier/datadog_notifier_test.rb
         
     | 
| 
       370 
362 
     | 
    
         
             
            - test/exception_notifier/email_notifier_test.rb
         
     | 
| 
       371 
363 
     | 
    
         
             
            - test/exception_notifier/google_chat_notifier_test.rb
         
     | 
| 
         @@ -389,8 +381,9 @@ files: 
     | 
|
| 
       389 
381 
     | 
    
         
             
            homepage: https://smartinez87.github.io/exception_notification/
         
     | 
| 
       390 
382 
     | 
    
         
             
            licenses:
         
     | 
| 
       391 
383 
     | 
    
         
             
            - MIT
         
     | 
| 
       392 
     | 
    
         
            -
            metadata: 
     | 
| 
       393 
     | 
    
         
            -
             
     | 
| 
      
 384 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 385 
     | 
    
         
            +
              changelog_uri: https://github.com/smartinez87/exception_notification/blob/master/CHANGELOG.rdoc
         
     | 
| 
      
 386 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       394 
387 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       395 
388 
     | 
    
         
             
            require_paths:
         
     | 
| 
       396 
389 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -405,14 +398,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       405 
398 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       406 
399 
     | 
    
         
             
                  version: 1.8.11
         
     | 
| 
       407 
400 
     | 
    
         
             
            requirements: []
         
     | 
| 
       408 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       409 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 401 
     | 
    
         
            +
            rubygems_version: 3.5.22
         
     | 
| 
      
 402 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       410 
403 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       411 
404 
     | 
    
         
             
            summary: Exception notification for Rails apps
         
     | 
| 
       412 
405 
     | 
    
         
             
            test_files:
         
     | 
| 
       413 
406 
     | 
    
         
             
            - test/exception_notification/rack_test.rb
         
     | 
| 
      
 407 
     | 
    
         
            +
            - test/exception_notification/rake_test.rb
         
     | 
| 
       414 
408 
     | 
    
         
             
            - test/exception_notification/resque_test.rb
         
     | 
| 
       415 
     | 
    
         
            -
            - test/exception_notifier/campfire_notifier_test.rb
         
     | 
| 
       416 
409 
     | 
    
         
             
            - test/exception_notifier/datadog_notifier_test.rb
         
     | 
| 
       417 
410 
     | 
    
         
             
            - test/exception_notifier/email_notifier_test.rb
         
     | 
| 
       418 
411 
     | 
    
         
             
            - test/exception_notifier/google_chat_notifier_test.rb
         
     | 
    
        data/examples/sample_app.rb
    DELETED
    
    | 
         @@ -1,56 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # -------------------------------------------
         
     | 
| 
       4 
     | 
    
         
            -
            # To run the application: ruby examples/sample_app.rb
         
     | 
| 
       5 
     | 
    
         
            -
            # -------------------------------------------
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            require 'bundler/inline'
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            gemfile do
         
     | 
| 
       10 
     | 
    
         
            -
              source 'https://rubygems.org'
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              gem 'rails', '5.0.0'
         
     | 
| 
       13 
     | 
    
         
            -
              gem 'exception_notification', '4.3.0'
         
     | 
| 
       14 
     | 
    
         
            -
              gem 'httparty', '0.15.7'
         
     | 
| 
       15 
     | 
    
         
            -
            end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            class SampleApp < Rails::Application
         
     | 
| 
       18 
     | 
    
         
            -
              config.middleware.use ExceptionNotification::Rack,
         
     | 
| 
       19 
     | 
    
         
            -
                                    webhook: {
         
     | 
| 
       20 
     | 
    
         
            -
                                      url: 'http://example.com'
         
     | 
| 
       21 
     | 
    
         
            -
                                    }
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              config.secret_key_base = 'my secret key base'
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              Rails.logger = Logger.new($stdout)
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              routes.draw do
         
     | 
| 
       28 
     | 
    
         
            -
                get '/', to: 'exceptions#index'
         
     | 
| 
       29 
     | 
    
         
            -
              end
         
     | 
| 
       30 
     | 
    
         
            -
            end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            require 'action_controller/railtie'
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            class ExceptionsController < ActionController::Base
         
     | 
| 
       35 
     | 
    
         
            -
              def index
         
     | 
| 
       36 
     | 
    
         
            -
                raise 'Sample exception raised, you should receive a notification!'
         
     | 
| 
       37 
     | 
    
         
            -
              end
         
     | 
| 
       38 
     | 
    
         
            -
            end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            require 'minitest/autorun'
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            class Test < Minitest::Test
         
     | 
| 
       43 
     | 
    
         
            -
              include Rack::Test::Methods
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
              def test_raise_exception
         
     | 
| 
       46 
     | 
    
         
            -
                get '/'
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                assert last_response.server_error?
         
     | 
| 
       49 
     | 
    
         
            -
              end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
              private
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              def app
         
     | 
| 
       54 
     | 
    
         
            -
                Rails.application
         
     | 
| 
       55 
     | 
    
         
            -
              end
         
     | 
| 
       56 
     | 
    
         
            -
            end
         
     | 
    
        data/examples/sinatra/Gemfile
    DELETED
    
    
| 
         @@ -1,95 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            PATH
         
     | 
| 
       2 
     | 
    
         
            -
              remote: ../../
         
     | 
| 
       3 
     | 
    
         
            -
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                exception_notification (3.0.1)
         
     | 
| 
       5 
     | 
    
         
            -
                  actionmailer (>= 3.0.4)
         
     | 
| 
       6 
     | 
    
         
            -
                  activesupport (>= 3.0.4)
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            GEM
         
     | 
| 
       9 
     | 
    
         
            -
              remote: https://rubygems.org/
         
     | 
| 
       10 
     | 
    
         
            -
              specs:
         
     | 
| 
       11 
     | 
    
         
            -
                actionmailer (3.2.13)
         
     | 
| 
       12 
     | 
    
         
            -
                  actionpack (= 3.2.13)
         
     | 
| 
       13 
     | 
    
         
            -
                  mail (~> 2.5.3)
         
     | 
| 
       14 
     | 
    
         
            -
                actionpack (3.2.13)
         
     | 
| 
       15 
     | 
    
         
            -
                  activemodel (= 3.2.13)
         
     | 
| 
       16 
     | 
    
         
            -
                  activesupport (= 3.2.13)
         
     | 
| 
       17 
     | 
    
         
            -
                  builder (~> 3.0.0)
         
     | 
| 
       18 
     | 
    
         
            -
                  erubis (~> 2.7.0)
         
     | 
| 
       19 
     | 
    
         
            -
                  journey (~> 1.0.4)
         
     | 
| 
       20 
     | 
    
         
            -
                  rack (~> 1.4.5)
         
     | 
| 
       21 
     | 
    
         
            -
                  rack-cache (~> 1.2)
         
     | 
| 
       22 
     | 
    
         
            -
                  rack-test (~> 0.6.1)
         
     | 
| 
       23 
     | 
    
         
            -
                  sprockets (~> 2.2.1)
         
     | 
| 
       24 
     | 
    
         
            -
                activemodel (3.2.13)
         
     | 
| 
       25 
     | 
    
         
            -
                  activesupport (= 3.2.13)
         
     | 
| 
       26 
     | 
    
         
            -
                  builder (~> 3.0.0)
         
     | 
| 
       27 
     | 
    
         
            -
                activesupport (3.2.13)
         
     | 
| 
       28 
     | 
    
         
            -
                  i18n (= 0.6.1)
         
     | 
| 
       29 
     | 
    
         
            -
                  multi_json (~> 1.0)
         
     | 
| 
       30 
     | 
    
         
            -
                builder (3.0.4)
         
     | 
| 
       31 
     | 
    
         
            -
                daemons (1.1.9)
         
     | 
| 
       32 
     | 
    
         
            -
                erubis (2.7.0)
         
     | 
| 
       33 
     | 
    
         
            -
                eventmachine (1.0.3)
         
     | 
| 
       34 
     | 
    
         
            -
                foreman (0.61.0)
         
     | 
| 
       35 
     | 
    
         
            -
                  thor (>= 0.13.6)
         
     | 
| 
       36 
     | 
    
         
            -
                haml (4.0.2)
         
     | 
| 
       37 
     | 
    
         
            -
                  tilt
         
     | 
| 
       38 
     | 
    
         
            -
                hike (1.2.1)
         
     | 
| 
       39 
     | 
    
         
            -
                i18n (0.6.1)
         
     | 
| 
       40 
     | 
    
         
            -
                journey (1.0.4)
         
     | 
| 
       41 
     | 
    
         
            -
                mail (2.5.3)
         
     | 
| 
       42 
     | 
    
         
            -
                  i18n (>= 0.4.0)
         
     | 
| 
       43 
     | 
    
         
            -
                  mime-types (~> 1.16)
         
     | 
| 
       44 
     | 
    
         
            -
                  treetop (~> 1.4.8)
         
     | 
| 
       45 
     | 
    
         
            -
                mailcatcher (0.5.11)
         
     | 
| 
       46 
     | 
    
         
            -
                  activesupport (~> 3.0)
         
     | 
| 
       47 
     | 
    
         
            -
                  eventmachine (~> 1.0.0)
         
     | 
| 
       48 
     | 
    
         
            -
                  haml (>= 3.1, < 5)
         
     | 
| 
       49 
     | 
    
         
            -
                  mail (~> 2.3)
         
     | 
| 
       50 
     | 
    
         
            -
                  sinatra (~> 1.2)
         
     | 
| 
       51 
     | 
    
         
            -
                  skinny (~> 0.2.3)
         
     | 
| 
       52 
     | 
    
         
            -
                  sqlite3 (~> 1.3)
         
     | 
| 
       53 
     | 
    
         
            -
                  thin (~> 1.5.0)
         
     | 
| 
       54 
     | 
    
         
            -
                mime-types (1.22)
         
     | 
| 
       55 
     | 
    
         
            -
                multi_json (1.7.2)
         
     | 
| 
       56 
     | 
    
         
            -
                polyglot (0.3.3)
         
     | 
| 
       57 
     | 
    
         
            -
                rack (1.4.5)
         
     | 
| 
       58 
     | 
    
         
            -
                rack-cache (1.2)
         
     | 
| 
       59 
     | 
    
         
            -
                  rack (>= 0.4)
         
     | 
| 
       60 
     | 
    
         
            -
                rack-protection (1.5.0)
         
     | 
| 
       61 
     | 
    
         
            -
                  rack
         
     | 
| 
       62 
     | 
    
         
            -
                rack-test (0.6.2)
         
     | 
| 
       63 
     | 
    
         
            -
                  rack (>= 1.0)
         
     | 
| 
       64 
     | 
    
         
            -
                sinatra (1.3.6)
         
     | 
| 
       65 
     | 
    
         
            -
                  rack (~> 1.4)
         
     | 
| 
       66 
     | 
    
         
            -
                  rack-protection (~> 1.3)
         
     | 
| 
       67 
     | 
    
         
            -
                  tilt (~> 1.3, >= 1.3.3)
         
     | 
| 
       68 
     | 
    
         
            -
                skinny (0.2.3)
         
     | 
| 
       69 
     | 
    
         
            -
                  eventmachine (~> 1.0.0)
         
     | 
| 
       70 
     | 
    
         
            -
                  thin (~> 1.5.0)
         
     | 
| 
       71 
     | 
    
         
            -
                sprockets (2.2.2)
         
     | 
| 
       72 
     | 
    
         
            -
                  hike (~> 1.2)
         
     | 
| 
       73 
     | 
    
         
            -
                  multi_json (~> 1.0)
         
     | 
| 
       74 
     | 
    
         
            -
                  rack (~> 1.0)
         
     | 
| 
       75 
     | 
    
         
            -
                  tilt (~> 1.1, != 1.3.0)
         
     | 
| 
       76 
     | 
    
         
            -
                sqlite3 (1.3.7)
         
     | 
| 
       77 
     | 
    
         
            -
                thin (1.5.1)
         
     | 
| 
       78 
     | 
    
         
            -
                  daemons (>= 1.0.9)
         
     | 
| 
       79 
     | 
    
         
            -
                  eventmachine (>= 0.12.6)
         
     | 
| 
       80 
     | 
    
         
            -
                  rack (>= 1.0.0)
         
     | 
| 
       81 
     | 
    
         
            -
                thor (0.18.1)
         
     | 
| 
       82 
     | 
    
         
            -
                tilt (1.3.6)
         
     | 
| 
       83 
     | 
    
         
            -
                treetop (1.4.12)
         
     | 
| 
       84 
     | 
    
         
            -
                  polyglot
         
     | 
| 
       85 
     | 
    
         
            -
                  polyglot (>= 0.3.1)
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
            PLATFORMS
         
     | 
| 
       88 
     | 
    
         
            -
              ruby
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
            DEPENDENCIES
         
     | 
| 
       91 
     | 
    
         
            -
              exception_notification!
         
     | 
| 
       92 
     | 
    
         
            -
              foreman
         
     | 
| 
       93 
     | 
    
         
            -
              mailcatcher
         
     | 
| 
       94 
     | 
    
         
            -
              sinatra (~> 1.3.5)
         
     | 
| 
       95 
     | 
    
         
            -
              thin (~> 1.5.1)
         
     | 
    
        data/examples/sinatra/Procfile
    DELETED
    
    
    
        data/examples/sinatra/README.md
    DELETED
    
    | 
         @@ -1,11 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Using Exception Notification with Sinatra
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            ## Quick start
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                git clone git@github.com:smartinez87/exception_notification.git
         
     | 
| 
       6 
     | 
    
         
            -
                cd exception_notification/examples/sinatra
         
     | 
| 
       7 
     | 
    
         
            -
                bundle install
         
     | 
| 
       8 
     | 
    
         
            -
                bundle exec foreman start
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            The last command starts two services, a smtp server and the sinatra app itself. Thus, visit [http://localhost:1080/](http://localhost:1080/) to check the emails sent and, in a separated tab, visit [http://localhost:3000](http://localhost:3000) and cause some errors. For more info, use the [source](https://github.com/smartinez87/exception_notification/blob/master/examples/sinatra/sinatra_app.rb) Luke.
         
     | 
    
        data/examples/sinatra/config.ru
    DELETED
    
    
| 
         @@ -1,40 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'bundler/setup'
         
     | 
| 
       5 
     | 
    
         
            -
            require 'sinatra/base'
         
     | 
| 
       6 
     | 
    
         
            -
            require 'exception_notification'
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            class SinatraApp < Sinatra::Base
         
     | 
| 
       9 
     | 
    
         
            -
              use Rack::Config do |env|
         
     | 
| 
       10 
     | 
    
         
            -
                # This is highly recommended.  It will prevent the ExceptionNotification email from including your users' passwords
         
     | 
| 
       11 
     | 
    
         
            -
                env['action_dispatch.parameter_filter'] = [:password]
         
     | 
| 
       12 
     | 
    
         
            -
              end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              use ExceptionNotification::Rack,
         
     | 
| 
       15 
     | 
    
         
            -
                  email: {
         
     | 
| 
       16 
     | 
    
         
            -
                    email_prefix: '[Example] ',
         
     | 
| 
       17 
     | 
    
         
            -
                    sender_address: %("notifier" <notifier@example.com>),
         
     | 
| 
       18 
     | 
    
         
            -
                    exception_recipients: %w[exceptions@example.com],
         
     | 
| 
       19 
     | 
    
         
            -
                    smtp_settings: {
         
     | 
| 
       20 
     | 
    
         
            -
                      address: 'localhost',
         
     | 
| 
       21 
     | 
    
         
            -
                      port: 1025
         
     | 
| 
       22 
     | 
    
         
            -
                    }
         
     | 
| 
       23 
     | 
    
         
            -
                  }
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              get '/' do
         
     | 
| 
       26 
     | 
    
         
            -
                raise StandardError, "ERROR: #{params[:error]}" unless params[:error].blank?
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                'Everything is fine! Now, lets break things clicking <a href="/?error=ops"> here </a>.' \
         
     | 
| 
       29 
     | 
    
         
            -
                'Dont forget to see the emails at <a href="http://localhost:1080">mailcatcher</a> !'
         
     | 
| 
       30 
     | 
    
         
            -
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              get '/background_notification' do
         
     | 
| 
       33 
     | 
    
         
            -
                begin
         
     | 
| 
       34 
     | 
    
         
            -
                  1 / 0
         
     | 
| 
       35 
     | 
    
         
            -
                rescue StandardError => e
         
     | 
| 
       36 
     | 
    
         
            -
                  ExceptionNotifier.notify_exception(e, data: { msg: 'Cannot divide by zero!' })
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
                'Check email at <a href="http://localhost:1080">mailcatcher</a>.'
         
     | 
| 
       39 
     | 
    
         
            -
              end
         
     | 
| 
       40 
     | 
    
         
            -
            end
         
     | 
    
        data/gemfiles/rails4_0.gemfile
    DELETED
    
    
    
        data/gemfiles/rails4_1.gemfile
    DELETED
    
    
    
        data/gemfiles/rails5_1.gemfile
    DELETED
    
    
| 
         @@ -1,41 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module ExceptionNotifier
         
     | 
| 
       4 
     | 
    
         
            -
              class CampfireNotifier < BaseNotifier
         
     | 
| 
       5 
     | 
    
         
            -
                attr_accessor :subdomain
         
     | 
| 
       6 
     | 
    
         
            -
                attr_accessor :token
         
     | 
| 
       7 
     | 
    
         
            -
                attr_accessor :room
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                def initialize(options)
         
     | 
| 
       10 
     | 
    
         
            -
                  super
         
     | 
| 
       11 
     | 
    
         
            -
                  begin
         
     | 
| 
       12 
     | 
    
         
            -
                    subdomain = options.delete(:subdomain)
         
     | 
| 
       13 
     | 
    
         
            -
                    room_name = options.delete(:room_name)
         
     | 
| 
       14 
     | 
    
         
            -
                    @campfire = Tinder::Campfire.new subdomain, options
         
     | 
| 
       15 
     | 
    
         
            -
                    @room     = @campfire.find_room_by_name room_name
         
     | 
| 
       16 
     | 
    
         
            -
                  rescue StandardError
         
     | 
| 
       17 
     | 
    
         
            -
                    @campfire = @room = nil
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                def call(exception, options = {})
         
     | 
| 
       22 
     | 
    
         
            -
                  return unless active?
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  message = if options[:accumulated_errors_count].to_i > 1
         
     | 
| 
       25 
     | 
    
         
            -
                              "The exception occurred #{options[:accumulated_errors_count]} times: '#{exception.message}'"
         
     | 
| 
       26 
     | 
    
         
            -
                            else
         
     | 
| 
       27 
     | 
    
         
            -
                              "A new exception occurred: '#{exception.message}'"
         
     | 
| 
       28 
     | 
    
         
            -
                            end
         
     | 
| 
       29 
     | 
    
         
            -
                  message += " on '#{exception.backtrace.first}'" if exception.backtrace
         
     | 
| 
       30 
     | 
    
         
            -
                  send_notice(exception, options, message) do |msg, _|
         
     | 
| 
       31 
     | 
    
         
            -
                    @room.paste msg
         
     | 
| 
       32 
     | 
    
         
            -
                  end
         
     | 
| 
       33 
     | 
    
         
            -
                end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                private
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                def active?
         
     | 
| 
       38 
     | 
    
         
            -
                  !@room.nil?
         
     | 
| 
       39 
     | 
    
         
            -
                end
         
     | 
| 
       40 
     | 
    
         
            -
              end
         
     | 
| 
       41 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,127 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'test_helper'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            # silence_warnings trick around require can be removed once
         
     | 
| 
       6 
     | 
    
         
            -
            # https://github.com/collectiveidea/tinder/pull/77
         
     | 
| 
       7 
     | 
    
         
            -
            # gets merged and released
         
     | 
| 
       8 
     | 
    
         
            -
            silence_warnings do
         
     | 
| 
       9 
     | 
    
         
            -
              require 'tinder'
         
     | 
| 
       10 
     | 
    
         
            -
            end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            class CampfireNotifierTest < ActiveSupport::TestCase
         
     | 
| 
       13 
     | 
    
         
            -
              test 'should send campfire notification if properly configured' do
         
     | 
| 
       14 
     | 
    
         
            -
                ExceptionNotifier::CampfireNotifier.stubs(:new).returns(Object.new)
         
     | 
| 
       15 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new(subdomain: 'test', token: 'test_token', room_name: 'test_room')
         
     | 
| 
       16 
     | 
    
         
            -
                campfire.stubs(:call).returns(fake_notification)
         
     | 
| 
       17 
     | 
    
         
            -
                notif = campfire.call(fake_exception)
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                assert !notif[:message].empty?
         
     | 
| 
       20 
     | 
    
         
            -
                assert_equal notif[:message][:type], 'PasteMessage'
         
     | 
| 
       21 
     | 
    
         
            -
                assert_includes notif[:message][:body], 'A new exception occurred:'
         
     | 
| 
       22 
     | 
    
         
            -
                assert_includes notif[:message][:body], 'divided by 0'
         
     | 
| 
       23 
     | 
    
         
            -
                assert_includes notif[:message][:body], '/exception_notification/test/campfire_test.rb:45'
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              test 'should send campfire notification without backtrace info if properly configured' do
         
     | 
| 
       27 
     | 
    
         
            -
                ExceptionNotifier::CampfireNotifier.stubs(:new).returns(Object.new)
         
     | 
| 
       28 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new(subdomain: 'test', token: 'test_token', room_name: 'test_room')
         
     | 
| 
       29 
     | 
    
         
            -
                campfire.stubs(:call).returns(fake_notification_without_backtrace)
         
     | 
| 
       30 
     | 
    
         
            -
                notif = campfire.call(fake_exception_without_backtrace)
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                assert !notif[:message].empty?
         
     | 
| 
       33 
     | 
    
         
            -
                assert_equal notif[:message][:type], 'PasteMessage'
         
     | 
| 
       34 
     | 
    
         
            -
                assert_includes notif[:message][:body], 'A new exception occurred:'
         
     | 
| 
       35 
     | 
    
         
            -
                assert_includes notif[:message][:body], 'my custom error'
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              test 'should not send campfire notification if badly configured' do
         
     | 
| 
       39 
     | 
    
         
            -
                wrong_params = { subdomain: 'test', token: 'bad_token', room_name: 'test_room' }
         
     | 
| 
       40 
     | 
    
         
            -
                Tinder::Campfire.stubs(:new).with('test', token: 'bad_token').returns(nil)
         
     | 
| 
       41 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new(wrong_params)
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                assert_nil campfire.room
         
     | 
| 
       44 
     | 
    
         
            -
                assert_nil campfire.call(fake_exception)
         
     | 
| 
       45 
     | 
    
         
            -
              end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
              test 'should not send campfire notification if config attr missing' do
         
     | 
| 
       48 
     | 
    
         
            -
                wrong_params = { subdomain: 'test', room_name: 'test_room' }
         
     | 
| 
       49 
     | 
    
         
            -
                Tinder::Campfire.stubs(:new).with('test', {}).returns(nil)
         
     | 
| 
       50 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new(wrong_params)
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                assert_nil campfire.room
         
     | 
| 
       53 
     | 
    
         
            -
                assert_nil campfire.call(fake_exception)
         
     | 
| 
       54 
     | 
    
         
            -
              end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
              test 'should send the new exception message if no :accumulated_errors_count option' do
         
     | 
| 
       57 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new({})
         
     | 
| 
       58 
     | 
    
         
            -
                campfire.stubs(:active?).returns(true)
         
     | 
| 
       59 
     | 
    
         
            -
                campfire.expects(:send_notice).with { |_, _, message| message.start_with?('A new exception occurred') }.once
         
     | 
| 
       60 
     | 
    
         
            -
                campfire.call(fake_exception)
         
     | 
| 
       61 
     | 
    
         
            -
              end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
              test 'shoud send the exception message if :accumulated_errors_count option greater than 1' do
         
     | 
| 
       64 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new({})
         
     | 
| 
       65 
     | 
    
         
            -
                campfire.stubs(:active?).returns(true)
         
     | 
| 
       66 
     | 
    
         
            -
                campfire.expects(:send_notice).with { |_, _, message| message.start_with?('The exception occurred 3 times:') }.once
         
     | 
| 
       67 
     | 
    
         
            -
                campfire.call(fake_exception, accumulated_errors_count: 3)
         
     | 
| 
       68 
     | 
    
         
            -
              end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
              test 'should call pre/post_callback if specified' do
         
     | 
| 
       71 
     | 
    
         
            -
                pre_callback_called = 0
         
     | 
| 
       72 
     | 
    
         
            -
                post_callback_called = 0
         
     | 
| 
       73 
     | 
    
         
            -
                Tinder::Campfire.stubs(:new).returns(Object.new)
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                campfire = ExceptionNotifier::CampfireNotifier.new(
         
     | 
| 
       76 
     | 
    
         
            -
                  subdomain: 'test',
         
     | 
| 
       77 
     | 
    
         
            -
                  token: 'test_token',
         
     | 
| 
       78 
     | 
    
         
            -
                  room_name: 'test_room',
         
     | 
| 
       79 
     | 
    
         
            -
                  pre_callback: proc { |_opts, _notifier, _backtrace, _message, _message_opts|
         
     | 
| 
       80 
     | 
    
         
            -
                    pre_callback_called += 1
         
     | 
| 
       81 
     | 
    
         
            -
                  },
         
     | 
| 
       82 
     | 
    
         
            -
                  post_callback: proc { |_opts, _notifier, _backtrace, _message, _message_opts|
         
     | 
| 
       83 
     | 
    
         
            -
                    post_callback_called += 1
         
     | 
| 
       84 
     | 
    
         
            -
                  }
         
     | 
| 
       85 
     | 
    
         
            -
                )
         
     | 
| 
       86 
     | 
    
         
            -
                campfire.room = Object.new
         
     | 
| 
       87 
     | 
    
         
            -
                campfire.room.stubs(:paste).returns(fake_notification)
         
     | 
| 
       88 
     | 
    
         
            -
                campfire.call(fake_exception)
         
     | 
| 
       89 
     | 
    
         
            -
                assert_equal(1, pre_callback_called)
         
     | 
| 
       90 
     | 
    
         
            -
                assert_equal(1, post_callback_called)
         
     | 
| 
       91 
     | 
    
         
            -
              end
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
              private
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
              def fake_notification
         
     | 
| 
       96 
     | 
    
         
            -
                {
         
     | 
| 
       97 
     | 
    
         
            -
                  message: {
         
     | 
| 
       98 
     | 
    
         
            -
                    type: 'PasteMessage',
         
     | 
| 
       99 
     | 
    
         
            -
                    body: fake_notification_body
         
     | 
| 
       100 
     | 
    
         
            -
                  }
         
     | 
| 
       101 
     | 
    
         
            -
                }
         
     | 
| 
       102 
     | 
    
         
            -
              end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
              def fake_notification_body
         
     | 
| 
       105 
     | 
    
         
            -
                "A new exception occurred: 'divided by 0' on " \
         
     | 
| 
       106 
     | 
    
         
            -
                "/Users/sebastian/exception_notification/test/campfire_test.rb:45:in `/'"
         
     | 
| 
       107 
     | 
    
         
            -
              end
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
              def fake_exception
         
     | 
| 
       110 
     | 
    
         
            -
                5 / 0
         
     | 
| 
       111 
     | 
    
         
            -
              rescue StandardError => e
         
     | 
| 
       112 
     | 
    
         
            -
                e
         
     | 
| 
       113 
     | 
    
         
            -
              end
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
              def fake_notification_without_backtrace
         
     | 
| 
       116 
     | 
    
         
            -
                {
         
     | 
| 
       117 
     | 
    
         
            -
                  message: {
         
     | 
| 
       118 
     | 
    
         
            -
                    type: 'PasteMessage',
         
     | 
| 
       119 
     | 
    
         
            -
                    body: "A new exception occurred: 'my custom error'"
         
     | 
| 
       120 
     | 
    
         
            -
                  }
         
     | 
| 
       121 
     | 
    
         
            -
                }
         
     | 
| 
       122 
     | 
    
         
            -
              end
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
              def fake_exception_without_backtrace
         
     | 
| 
       125 
     | 
    
         
            -
                StandardError.new('my custom error')
         
     | 
| 
       126 
     | 
    
         
            -
              end
         
     | 
| 
       127 
     | 
    
         
            -
            end
         
     |