hoptoad_notifier 2.3.7 → 2.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,6 @@ module HoptoadNotifier
22
22
  :use_full_path => false,
23
23
  :locals => {
24
24
  :host => host,
25
- :secure => HoptoadNotifier.configuration.secure,
26
25
  :api_key => HoptoadNotifier.configuration.api_key,
27
26
  :environment => HoptoadNotifier.configuration.environment_name
28
27
  }
@@ -3,6 +3,14 @@ module HoptoadNotifier
3
3
  class Sender
4
4
 
5
5
  NOTICES_URI = '/notifier_api/v2/notices/'.freeze
6
+ HTTP_ERRORS = [Timeout::Error,
7
+ Errno::EINVAL,
8
+ Errno::ECONNRESET,
9
+ EOFError,
10
+ Net::HTTPBadResponse,
11
+ Net::HTTPHeaderSyntaxError,
12
+ Net::ProtocolError,
13
+ Errno::ECONNREFUSED].freeze
6
14
 
7
15
  def initialize(options = {})
8
16
  [:proxy_host, :proxy_port, :proxy_user, :proxy_pass, :protocol,
@@ -27,7 +35,7 @@ module HoptoadNotifier
27
35
 
28
36
  response = begin
29
37
  http.post(url.path, data, HEADERS)
30
- rescue TimeoutError => e
38
+ rescue *HTTP_ERRORS => e
31
39
  log :error, "Timeout while contacting the Hoptoad server."
32
40
  nil
33
41
  end
@@ -89,7 +89,7 @@ namespace :hoptoad do
89
89
  class HoptoadVerificationController < ApplicationController; end
90
90
 
91
91
  puts 'Processing request.'
92
- request = ActionController::TestRequest.new
92
+ request = ActionController::TestRequest.new("REQUEST_URI" => "/hoptoad_verification_controller")
93
93
  response = ActionController::TestResponse.new
94
94
  HoptoadVerificationController.new.process(request, response)
95
95
  end
@@ -1,3 +1,3 @@
1
1
  module HoptoadNotifier
2
- VERSION = "2.3.7".freeze
2
+ VERSION = "2.3.8".freeze
3
3
  end
@@ -1,4 +1,10 @@
1
- <script type="text/javascript" src="http<%= 's' if secure %>://<%= host %>/javascripts/notifier.js"></script>
1
+ <script type="text/javascript">
2
+ //<![CDATA[
3
+ var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
4
+ document.write(unescape("%3Cscript src='" + notifierJsScheme + "<%= host %>/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
5
+ //]]>
6
+ </script>
7
+
2
8
  <script type="text/javascript">
3
9
  Hoptoad.setKey('<%= api_key %>');
4
10
  Hoptoad.setHost('<%= host %>');
data/test/helper.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
3
 
4
+ gem "activesupport", "= 2.3.8"
5
+ gem "activerecord", "= 2.3.8"
6
+ gem "actionpack", "= 2.3.8"
7
+ gem "nokogiri", "= 1.4.3.1"
8
+ gem "shoulda", "= 2.11.3"
4
9
  gem 'jferris-mocha', '>= 0.9.5.0.1241126838'
5
10
 
6
11
  $LOAD_PATH << File.join(File.dirname(__FILE__), *%w[.. vendor ginger lib])
@@ -11,6 +16,7 @@ require 'mocha'
11
16
 
12
17
  require 'ginger'
13
18
 
19
+
14
20
  require 'action_controller'
15
21
  require 'action_controller/test_process'
16
22
  require 'active_record'
data/test/sender_test.rb CHANGED
@@ -58,6 +58,32 @@ class SenderTest < Test::Unit::TestCase
58
58
  end
59
59
  end
60
60
 
61
+ should "not fail when posting and a timeout exception occurs" do
62
+ http = stub_http
63
+ http.stubs(:post).raises(TimeoutError)
64
+ assert_nothing_thrown do
65
+ send_exception(:secure => false)
66
+ end
67
+ end
68
+
69
+ should "not fail when posting and a connection refused exception occurs" do
70
+ http = stub_http
71
+ http.stubs(:post).raises(Errno::ECONNREFUSED)
72
+ assert_nothing_thrown do
73
+ send_exception(:secure => false)
74
+ end
75
+ end
76
+
77
+ should "not fail when posting any http exception occurs" do
78
+ http = stub_http
79
+ HoptoadNotifier::Sender::HTTP_ERRORS.each do |error|
80
+ http.stubs(:post).raises(error)
81
+ assert_nothing_thrown do
82
+ send_exception(:secure => false)
83
+ end
84
+ end
85
+ end
86
+
61
87
  should "post to the right url for non-ssl" do
62
88
  http = stub_http
63
89
  url = "http://hoptoadapp.com:80#{HoptoadNotifier::Sender::NOTICES_URI}"
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoptoad_notifier
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 2
7
8
  - 3
8
- - 7
9
- version: 2.3.7
9
+ - 8
10
+ version: 2.3.8
10
11
  platform: ruby
11
12
  authors:
12
13
  - thoughtbot, inc
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-15 00:00:00 -04:00
18
+ date: 2010-09-29 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: activesupport
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: activerecord
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 3
39
44
  segments:
40
45
  - 0
41
46
  version: "0"
@@ -45,9 +50,11 @@ dependencies:
45
50
  name: actionpack
46
51
  prerelease: false
47
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
48
54
  requirements:
49
55
  - - ">="
50
56
  - !ruby/object:Gem::Version
57
+ hash: 3
51
58
  segments:
52
59
  - 0
53
60
  version: "0"
@@ -57,9 +64,11 @@ dependencies:
57
64
  name: jferris-mocha
58
65
  prerelease: false
59
66
  requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
60
68
  requirements:
61
69
  - - ">="
62
70
  - !ruby/object:Gem::Version
71
+ hash: 3
63
72
  segments:
64
73
  - 0
65
74
  version: "0"
@@ -69,9 +78,11 @@ dependencies:
69
78
  name: nokogiri
70
79
  prerelease: false
71
80
  requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ">="
74
84
  - !ruby/object:Gem::Version
85
+ hash: 3
75
86
  segments:
76
87
  - 0
77
88
  version: "0"
@@ -81,9 +92,11 @@ dependencies:
81
92
  name: shoulda
82
93
  prerelease: false
83
94
  requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
84
96
  requirements:
85
97
  - - ">="
86
98
  - !ruby/object:Gem::Version
99
+ hash: 3
87
100
  segments:
88
101
  - 0
89
102
  version: "0"
@@ -156,23 +169,27 @@ rdoc_options:
156
169
  require_paths:
157
170
  - lib
158
171
  required_ruby_version: !ruby/object:Gem::Requirement
172
+ none: false
159
173
  requirements:
160
174
  - - ">="
161
175
  - !ruby/object:Gem::Version
176
+ hash: 3
162
177
  segments:
163
178
  - 0
164
179
  version: "0"
165
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
+ none: false
166
182
  requirements:
167
183
  - - ">="
168
184
  - !ruby/object:Gem::Version
185
+ hash: 3
169
186
  segments:
170
187
  - 0
171
188
  version: "0"
172
189
  requirements: []
173
190
 
174
191
  rubyforge_project:
175
- rubygems_version: 1.3.6
192
+ rubygems_version: 1.3.7
176
193
  signing_key:
177
194
  specification_version: 3
178
195
  summary: Send your application errors to our hosted service and reclaim your inbox.