errornot_notifier 0.1.0 → 1.0.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.
Files changed (45) hide show
  1. data/CHANGELOG +5 -0
  2. data/INSTALL +8 -8
  3. data/README.rdoc +63 -53
  4. data/Rakefile +92 -8
  5. data/TESTING.rdoc +1 -1
  6. data/generators/{hoptoad/hoptoad_generator.rb → errornot/errornot_generator.rb} +6 -6
  7. data/generators/{hoptoad → errornot}/lib/insert_commands.rb +0 -0
  8. data/generators/{hoptoad → errornot}/lib/rake_commands.rb +0 -0
  9. data/generators/errornot/templates/capistrano_hook.rb +6 -0
  10. data/generators/errornot/templates/errornot_notifier_tasks.rake +5 -0
  11. data/generators/{hoptoad → errornot}/templates/initializer.rb +2 -2
  12. data/lib/{hoptoad_notifier → errornot_notifier}/backtrace.rb +1 -1
  13. data/lib/errornot_notifier/capistrano.rb +20 -0
  14. data/lib/{hoptoad_notifier → errornot_notifier}/configuration.rb +14 -16
  15. data/lib/{hoptoad_notifier → errornot_notifier}/notice.rb +2 -2
  16. data/lib/{hoptoad_notifier → errornot_notifier}/rack.rb +8 -8
  17. data/lib/{hoptoad_notifier → errornot_notifier}/rails/action_controller_catcher.rb +9 -9
  18. data/lib/{hoptoad_notifier → errornot_notifier}/rails/controller_methods.rb +15 -15
  19. data/lib/{hoptoad_notifier → errornot_notifier}/rails/error_lookup.rb +9 -9
  20. data/lib/{hoptoad_notifier → errornot_notifier}/rails.rb +11 -11
  21. data/lib/{hoptoad_notifier → errornot_notifier}/sender.rb +8 -8
  22. data/lib/{hoptoad_notifier → errornot_notifier}/tasks.rb +19 -19
  23. data/lib/errornot_notifier/version.rb +3 -0
  24. data/lib/{hoptoad_notifier.rb → errornot_notifier.rb} +20 -20
  25. data/lib/{hoptoad_tasks.rb → errornot_tasks.rb} +9 -7
  26. data/lib/templates/rescue.erb +5 -5
  27. data/rails/init.rb +1 -1
  28. data/script/integration_test.rb +6 -6
  29. data/test/backtrace_test.rb +16 -16
  30. data/test/catcher_test.rb +22 -22
  31. data/test/configuration_test.rb +21 -23
  32. data/test/erronot_tasks_test.rb +147 -0
  33. data/test/helper.rb +16 -15
  34. data/test/logger_test.rb +12 -10
  35. data/test/notice_test.rb +9 -9
  36. data/test/notifier_test.rb +30 -30
  37. data/test/rack_test.rb +7 -7
  38. data/test/rails_initializer_test.rb +8 -8
  39. data/test/sender_test.rb +13 -12
  40. metadata +73 -53
  41. data/generators/hoptoad/templates/capistrano_hook.rb +0 -6
  42. data/generators/hoptoad/templates/hoptoad_notifier_tasks.rake +0 -5
  43. data/lib/hoptoad_notifier/capistrano.rb +0 -20
  44. data/lib/hoptoad_notifier/version.rb +0 -3
  45. data/test/hoptoad_tasks_test.rb +0 -138
data/test/helper.rb CHANGED
@@ -19,7 +19,7 @@ require 'active_support'
19
19
  require 'nokogiri'
20
20
  require 'rack'
21
21
 
22
- require "hoptoad_notifier"
22
+ require "errornot_notifier"
23
23
 
24
24
  begin require 'redgreen'; rescue LoadError; end
25
25
 
@@ -29,7 +29,7 @@ module TestMethods
29
29
  end
30
30
 
31
31
  def do_raise
32
- raise "Hoptoad"
32
+ raise "Errornot"
33
33
  end
34
34
 
35
35
  def do_not_raise
@@ -45,17 +45,17 @@ module TestMethods
45
45
  end
46
46
 
47
47
  def manual_notify
48
- notify_hoptoad(Exception.new)
48
+ notify_errornot(Exception.new)
49
49
  render :text => "Success"
50
50
  end
51
51
 
52
52
  def manual_notify_ignored
53
- notify_hoptoad(ActiveRecord::RecordNotFound.new("404"))
53
+ notify_errornot(ActiveRecord::RecordNotFound.new("404"))
54
54
  render :text => "Success"
55
55
  end
56
56
  end
57
57
 
58
- class HoptoadController < ActionController::Base
58
+ class ErrornotController < ActionController::Base
59
59
  include TestMethods
60
60
  end
61
61
 
@@ -96,11 +96,11 @@ class Test::Unit::TestCase
96
96
  end
97
97
 
98
98
  def stub_sender
99
- stub('sender', :send_to_hoptoad => nil)
99
+ stub('sender', :send_to_errornot => nil)
100
100
  end
101
101
 
102
102
  def stub_sender!
103
- HoptoadNotifier.sender = stub_sender
103
+ ErrornotNotifier.sender = stub_sender
104
104
  end
105
105
 
106
106
  def stub_notice
@@ -109,23 +109,24 @@ class Test::Unit::TestCase
109
109
 
110
110
  def stub_notice!
111
111
  returning stub_notice do |notice|
112
- HoptoadNotifier::Notice.stubs(:new => notice)
112
+ ErrornotNotifier::Notice.stubs(:new => notice)
113
113
  end
114
114
  end
115
115
 
116
116
  def create_dummy
117
- HoptoadNotifier::DummySender.new
117
+ ErrornotNotifier::DummySender.new
118
118
  end
119
119
 
120
120
  def reset_config
121
- HoptoadNotifier.configuration = nil
122
- HoptoadNotifier.configure do |config|
121
+ ErrornotNotifier.configuration = nil
122
+ ErrornotNotifier.configure do |config|
123
+ config.host = "localhost"
123
124
  config.api_key = 'abc123'
124
125
  end
125
126
  end
126
127
 
127
128
  def clear_backtrace_filters
128
- HoptoadNotifier.configuration.backtrace_filters.clear
129
+ ErrornotNotifier.configuration.backtrace_filters.clear
129
130
  end
130
131
 
131
132
  def build_exception
@@ -155,11 +156,11 @@ class Test::Unit::TestCase
155
156
  end
156
157
 
157
158
  def assert_caught_and_sent
158
- assert !HoptoadNotifier.sender.collected.empty?
159
+ assert !ErrornotNotifier.sender.collected.empty?
159
160
  end
160
161
 
161
162
  def assert_caught_and_not_sent
162
- assert HoptoadNotifier.sender.collected.empty?
163
+ assert ErrornotNotifier.sender.collected.empty?
163
164
  end
164
165
 
165
166
  def assert_array_starts_with(expected, actual)
@@ -217,7 +218,7 @@ class CollectingSender
217
218
  @collected = []
218
219
  end
219
220
 
220
- def send_to_hoptoad(data)
221
+ def send_to_errornot(data)
221
222
  @collected << data
222
223
  end
223
224
  end
data/test/logger_test.rb CHANGED
@@ -11,27 +11,29 @@ class LoggerTest < Test::Unit::TestCase
11
11
  end
12
12
 
13
13
  def send_notice
14
- HoptoadNotifier.sender.send_to_hoptoad('data')
14
+ ErrornotNotifier.sender.send_to_errornot('data')
15
15
  end
16
16
 
17
17
  def stub_verbose_log
18
- HoptoadNotifier.stubs(:write_verbose_log)
18
+ ErrornotNotifier.stubs(:write_verbose_log)
19
19
  end
20
20
 
21
21
  def assert_logged(expected)
22
- assert_received(HoptoadNotifier, :write_verbose_log) do |expect|
22
+ assert_received(ErrornotNotifier, :write_verbose_log) do |expect|
23
23
  expect.with {|actual| actual =~ expected }
24
24
  end
25
25
  end
26
26
 
27
27
  def assert_not_logged(expected)
28
- assert_received(HoptoadNotifier, :write_verbose_log) do |expect|
28
+ assert_received(ErrornotNotifier, :write_verbose_log) do |expect|
29
29
  expect.with {|actual| actual =~ expected }.never
30
30
  end
31
31
  end
32
32
 
33
33
  def configure
34
- HoptoadNotifier.configure { |config| }
34
+ ErrornotNotifier.configure { |config|
35
+ config.host = "localhost"
36
+ }
35
37
  end
36
38
 
37
39
  should "report that notifier is ready when configured" do
@@ -42,7 +44,7 @@ class LoggerTest < Test::Unit::TestCase
42
44
 
43
45
  should "not report that notifier is ready when internally configured" do
44
46
  stub_verbose_log
45
- HoptoadNotifier.configure(true) { |config| }
47
+ ErrornotNotifier.configure(true) { |config| }
46
48
  assert_not_logged /.*/
47
49
  end
48
50
 
@@ -52,7 +54,7 @@ class LoggerTest < Test::Unit::TestCase
52
54
  stub_http(Net::HTTPSuccess)
53
55
  send_notice
54
56
  assert_logged /Environment Info:/
55
- assert_not_logged /Response from Hoptoad:/
57
+ assert_not_logged /Response from Errornot:/
56
58
  end
57
59
 
58
60
  should "print environment info on a failed notification without a body" do
@@ -61,7 +63,7 @@ class LoggerTest < Test::Unit::TestCase
61
63
  stub_http(Net::HTTPError)
62
64
  send_notice
63
65
  assert_logged /Environment Info:/
64
- assert_not_logged /Response from Hoptoad:/
66
+ assert_not_logged /Response from Errornot:/
65
67
  end
66
68
 
67
69
  should "print environment info and response on a success with a body" do
@@ -70,7 +72,7 @@ class LoggerTest < Test::Unit::TestCase
70
72
  stub_http(Net::HTTPSuccess, 'test')
71
73
  send_notice
72
74
  assert_logged /Environment Info:/
73
- assert_logged /Response from Hoptoad:/
75
+ assert_logged /Response from Errornot:/
74
76
  end
75
77
 
76
78
  should "print environment info and response on a failure with a body" do
@@ -79,7 +81,7 @@ class LoggerTest < Test::Unit::TestCase
79
81
  stub_http(Net::HTTPError, 'test')
80
82
  send_notice
81
83
  assert_logged /Environment Info:/
82
- assert_logged /Response from Hoptoad:/
84
+ assert_logged /Response from Errornot:/
83
85
  end
84
86
 
85
87
  end
data/test/notice_test.rb CHANGED
@@ -5,14 +5,14 @@ class NoticeTest < Test::Unit::TestCase
5
5
  include DefinesConstants
6
6
 
7
7
  def configure
8
- returning HoptoadNotifier::Configuration.new do |config|
8
+ returning ErrornotNotifier::Configuration.new do |config|
9
9
  config.api_key = 'abc123def456'
10
10
  end
11
11
  end
12
12
 
13
13
  def build_notice(args = {})
14
14
  configuration = args.delete(:configuration) || configure
15
- HoptoadNotifier::Notice.new(configuration.merge(args))
15
+ ErrornotNotifier::Notice.new(configuration.merge(args))
16
16
  end
17
17
 
18
18
  def stub_request(attrs = {})
@@ -59,7 +59,7 @@ class NoticeTest < Test::Unit::TestCase
59
59
  array = ["user.rb:34:in `crazy'"]
60
60
  exception = build_exception
61
61
  exception.set_backtrace array
62
- backtrace = HoptoadNotifier::Backtrace.parse(array)
62
+ backtrace = ErrornotNotifier::Backtrace.parse(array)
63
63
  notice_from_exception = build_notice(:exception => exception)
64
64
 
65
65
 
@@ -77,9 +77,9 @@ class NoticeTest < Test::Unit::TestCase
77
77
  backtrace_array = ['my/file/backtrace:3']
78
78
  exception = build_exception
79
79
  exception.set_backtrace(backtrace_array)
80
- HoptoadNotifier::Backtrace.expects(:parse).with(backtrace_array, {:filters => 'foo'})
80
+ ErrornotNotifier::Backtrace.expects(:parse).with(backtrace_array, {:filters => 'foo'})
81
81
 
82
- notice = HoptoadNotifier::Notice.new({:exception => exception, :backtrace_filters => 'foo'})
82
+ notice = ErrornotNotifier::Notice.new({:exception => exception, :backtrace_filters => 'foo'})
83
83
  end
84
84
 
85
85
  should "set the error class from an exception or hash" do
@@ -133,7 +133,7 @@ class NoticeTest < Test::Unit::TestCase
133
133
  end
134
134
 
135
135
  should "set sensible defaults without an exception" do
136
- backtrace = HoptoadNotifier::Backtrace.parse(build_backtrace_array)
136
+ backtrace = ErrornotNotifier::Backtrace.parse(build_backtrace_array)
137
137
  notice = build_notice(:backtrace => build_backtrace_array)
138
138
 
139
139
  assert_equal 'Notification', notice.error_message
@@ -143,8 +143,8 @@ class NoticeTest < Test::Unit::TestCase
143
143
  end
144
144
 
145
145
  should "use the caller as the backtrace for an exception without a backtrace" do
146
- filters = HoptoadNotifier::Configuration.new.backtrace_filters
147
- backtrace = HoptoadNotifier::Backtrace.parse(caller, :filters => filters)
146
+ filters = ErrornotNotifier::Configuration.new.backtrace_filters
147
+ backtrace = ErrornotNotifier::Backtrace.parse(caller, :filters => filters)
148
148
  notice = build_notice(:exception => StandardError.new('error'), :backtrace => nil)
149
149
 
150
150
  assert_array_starts_with backtrace.lines, notice.backtrace.lines
@@ -166,7 +166,7 @@ class NoticeTest < Test::Unit::TestCase
166
166
 
167
167
  context "a Notice turned into XML" do
168
168
  setup do
169
- HoptoadNotifier.configure do |config|
169
+ ErrornotNotifier.configure do |config|
170
170
  config.api_key = "1234567890"
171
171
  end
172
172
 
@@ -16,48 +16,48 @@ class NotifierTest < Test::Unit::TestCase
16
16
  end
17
17
 
18
18
  def assert_sent(notice, notice_args)
19
- assert_received(HoptoadNotifier::Notice, :new) {|expect| expect.with(has_entries(notice_args)) }
19
+ assert_received(ErrornotNotifier::Notice, :new) {|expect| expect.with(has_entries(notice_args)) }
20
20
  assert_received(notice, :to_xml)
21
- assert_received(HoptoadNotifier.sender, :send_to_hoptoad) {|expect| expect.with(notice.to_xml) }
21
+ assert_received(ErrornotNotifier.sender, :send_to_errornot) {|expect| expect.with(notice.to_xml) }
22
22
  end
23
23
 
24
24
  def set_public_env
25
- HoptoadNotifier.configure { |config| config.environment_name = 'production' }
25
+ ErrornotNotifier.configure { |config| config.environment_name = 'production' }
26
26
  end
27
27
 
28
28
  def set_development_env
29
- HoptoadNotifier.configure { |config| config.environment_name = 'development' }
29
+ ErrornotNotifier.configure { |config| config.environment_name = 'development' }
30
30
  end
31
31
 
32
32
  should "yield and save a configuration when configuring" do
33
33
  yielded_configuration = nil
34
- HoptoadNotifier.configure do |config|
34
+ ErrornotNotifier.configure do |config|
35
35
  yielded_configuration = config
36
36
  end
37
37
 
38
- assert_kind_of HoptoadNotifier::Configuration, yielded_configuration
39
- assert_equal yielded_configuration, HoptoadNotifier.configuration
38
+ assert_kind_of ErrornotNotifier::Configuration, yielded_configuration
39
+ assert_equal yielded_configuration, ErrornotNotifier.configuration
40
40
  end
41
41
 
42
42
  should "not remove existing config options when configuring twice" do
43
43
  first_config = nil
44
- HoptoadNotifier.configure do |config|
44
+ ErrornotNotifier.configure do |config|
45
45
  first_config = config
46
46
  end
47
- HoptoadNotifier.configure do |config|
47
+ ErrornotNotifier.configure do |config|
48
48
  assert_equal first_config, config
49
49
  end
50
50
  end
51
51
 
52
52
  should "configure the sender" do
53
53
  sender = stub_sender
54
- HoptoadNotifier::Sender.stubs(:new => sender)
54
+ ErrornotNotifier::Sender.stubs(:new => sender)
55
55
  configuration = nil
56
56
 
57
- HoptoadNotifier.configure { |yielded_config| configuration = yielded_config }
57
+ ErrornotNotifier.configure { |yielded_config| configuration = yielded_config }
58
58
 
59
- assert_received(HoptoadNotifier::Sender, :new) { |expect| expect.with(configuration) }
60
- assert_equal sender, HoptoadNotifier.sender
59
+ assert_received(ErrornotNotifier::Sender, :new) { |expect| expect.with(configuration) }
60
+ assert_equal sender, ErrornotNotifier.sender
61
61
  end
62
62
 
63
63
  should "create and send a notice for an exception" do
@@ -66,7 +66,7 @@ class NotifierTest < Test::Unit::TestCase
66
66
  stub_sender!
67
67
  notice = stub_notice!
68
68
 
69
- HoptoadNotifier.notify(exception)
69
+ ErrornotNotifier.notify(exception)
70
70
 
71
71
  assert_sent notice, :exception => exception
72
72
  end
@@ -77,7 +77,7 @@ class NotifierTest < Test::Unit::TestCase
77
77
  notice_args = { :error_message => 'uh oh' }
78
78
  stub_sender!
79
79
 
80
- HoptoadNotifier.notify(notice_args)
80
+ ErrornotNotifier.notify(notice_args)
81
81
 
82
82
  assert_sent(notice, notice_args)
83
83
  end
@@ -89,7 +89,7 @@ class NotifierTest < Test::Unit::TestCase
89
89
  notice_args = { :error_message => 'uh oh' }
90
90
  stub_sender!
91
91
 
92
- HoptoadNotifier.notify(exception, notice_args)
92
+ ErrornotNotifier.notify(exception, notice_args)
93
93
 
94
94
  assert_sent(notice, notice_args.merge(:exception => exception))
95
95
  end
@@ -98,10 +98,10 @@ class NotifierTest < Test::Unit::TestCase
98
98
  set_development_env
99
99
  sender = stub_sender!
100
100
 
101
- HoptoadNotifier.notify(build_exception)
102
- HoptoadNotifier.notify_or_ignore(build_exception)
101
+ ErrornotNotifier.notify(build_exception)
102
+ ErrornotNotifier.notify_or_ignore(build_exception)
103
103
 
104
- assert_received(sender, :send_to_hoptoad) {|expect| expect.never }
104
+ assert_received(sender, :send_to_errornot) {|expect| expect.never }
105
105
  end
106
106
 
107
107
  should "not deliver an ignored exception when notifying implicitly" do
@@ -111,9 +111,9 @@ class NotifierTest < Test::Unit::TestCase
111
111
  notice = stub_notice!
112
112
  notice.stubs(:ignore? => true)
113
113
 
114
- HoptoadNotifier.notify_or_ignore(exception)
114
+ ErrornotNotifier.notify_or_ignore(exception)
115
115
 
116
- assert_received(sender, :send_to_hoptoad) {|expect| expect.never }
116
+ assert_received(sender, :send_to_errornot) {|expect| expect.never }
117
117
  end
118
118
 
119
119
  should "deliver an ignored exception when notifying manually" do
@@ -123,7 +123,7 @@ class NotifierTest < Test::Unit::TestCase
123
123
  notice = stub_notice!
124
124
  notice.stubs(:ignore? => true)
125
125
 
126
- HoptoadNotifier.notify(exception)
126
+ ErrornotNotifier.notify(exception)
127
127
 
128
128
  assert_sent(notice, :exception => exception)
129
129
  end
@@ -133,11 +133,11 @@ class NotifierTest < Test::Unit::TestCase
133
133
  config_opts = { 'one' => 'two', 'three' => 'four' }
134
134
  notice = stub_notice!
135
135
  stub_sender!
136
- HoptoadNotifier.configuration = stub('config', :merge => config_opts, :public? => true)
136
+ ErrornotNotifier.configuration = stub('config', :merge => config_opts, :public? => true)
137
137
 
138
- HoptoadNotifier.notify(exception)
138
+ ErrornotNotifier.notify(exception)
139
139
 
140
- assert_received(HoptoadNotifier::Notice, :new) do |expect|
140
+ assert_received(ErrornotNotifier::Notice, :new) do |expect|
141
141
  expect.with(has_entries(config_opts))
142
142
  end
143
143
  end
@@ -146,7 +146,7 @@ class NotifierTest < Test::Unit::TestCase
146
146
  setup do
147
147
  @params = { :controller => "users", :action => "create" }
148
148
  @exception = build_exception
149
- @hash = HoptoadNotifier.build_lookup_hash_for(@exception, @params)
149
+ @hash = ErrornotNotifier.build_lookup_hash_for(@exception, @params)
150
150
  end
151
151
 
152
152
  should "set action" do
@@ -176,14 +176,14 @@ class NotifierTest < Test::Unit::TestCase
176
176
  should "not set file or line number with no backtrace" do
177
177
  @exception.stubs(:backtrace).returns([])
178
178
 
179
- @hash = HoptoadNotifier.build_lookup_hash_for(@exception)
179
+ @hash = ErrornotNotifier.build_lookup_hash_for(@exception)
180
180
 
181
181
  assert_nil @hash[:line_number]
182
182
  assert_nil @hash[:file]
183
183
  end
184
184
 
185
185
  should "not set action or controller when not provided" do
186
- @hash = HoptoadNotifier.build_lookup_hash_for(@exception)
186
+ @hash = ErrornotNotifier.build_lookup_hash_for(@exception)
187
187
 
188
188
  assert_nil @hash[:action]
189
189
  assert_nil @hash[:controller]
@@ -199,7 +199,7 @@ class NotifierTest < Test::Unit::TestCase
199
199
  end
200
200
 
201
201
  should "unwrap exceptions that provide #original_exception" do
202
- @hash = HoptoadNotifier.build_lookup_hash_for(@exception)
202
+ @hash = ErrornotNotifier.build_lookup_hash_for(@exception)
203
203
  assert_equal "NotifierTest::OriginalException", @hash[:error_class]
204
204
  end
205
205
  end
@@ -214,7 +214,7 @@ class NotifierTest < Test::Unit::TestCase
214
214
  end
215
215
 
216
216
  should "unwrap exceptions that provide #continued_exception" do
217
- @hash = HoptoadNotifier.build_lookup_hash_for(@exception)
217
+ @hash = ErrornotNotifier.build_lookup_hash_for(@exception)
218
218
  assert_equal "NotifierTest::ContinuedException", @hash[:error_class]
219
219
  end
220
220
  end
data/test/rack_test.rb CHANGED
@@ -5,7 +5,7 @@ class RackTest < Test::Unit::TestCase
5
5
  should "call the upstream app with the environment" do
6
6
  environment = { 'key' => 'value' }
7
7
  app = lambda { |env| ['response', {}, env] }
8
- stack = HoptoadNotifier::Rack.new(app)
8
+ stack = ErrornotNotifier::Rack.new(app)
9
9
 
10
10
  response = stack.call(environment)
11
11
 
@@ -13,7 +13,7 @@ class RackTest < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  should "deliver an exception raised while calling an upstream app" do
16
- HoptoadNotifier.stubs(:notify_or_ignore)
16
+ ErrornotNotifier.stubs(:notify_or_ignore)
17
17
 
18
18
  exception = build_exception
19
19
  environment = { 'key' => 'value' }
@@ -22,7 +22,7 @@ class RackTest < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  begin
25
- stack = HoptoadNotifier::Rack.new(app)
25
+ stack = ErrornotNotifier::Rack.new(app)
26
26
  stack.call(environment)
27
27
  rescue Exception => raised
28
28
  assert_equal exception, raised
@@ -30,13 +30,13 @@ class RackTest < Test::Unit::TestCase
30
30
  flunk "Didn't raise an exception"
31
31
  end
32
32
 
33
- assert_received(HoptoadNotifier, :notify_or_ignore) do |expect|
33
+ assert_received(ErrornotNotifier, :notify_or_ignore) do |expect|
34
34
  expect.with(exception, :rack_env => environment)
35
35
  end
36
36
  end
37
37
 
38
38
  should "deliver an exception in rack.exception" do
39
- HoptoadNotifier.stubs(:notify_or_ignore)
39
+ ErrornotNotifier.stubs(:notify_or_ignore)
40
40
  exception = build_exception
41
41
  environment = { 'key' => 'value' }
42
42
 
@@ -45,12 +45,12 @@ class RackTest < Test::Unit::TestCase
45
45
  env['rack.exception'] = exception
46
46
  response
47
47
  end
48
- stack = HoptoadNotifier::Rack.new(app)
48
+ stack = ErrornotNotifier::Rack.new(app)
49
49
 
50
50
  actual_response = stack.call(environment)
51
51
 
52
52
  assert_equal response, actual_response
53
- assert_received(HoptoadNotifier, :notify_or_ignore) do |expect|
53
+ assert_received(ErrornotNotifier, :notify_or_ignore) do |expect|
54
54
  expect.with(exception, :rack_env => environment)
55
55
  end
56
56
  end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/helper'
2
2
 
3
- require 'hoptoad_notifier/rails'
3
+ require 'errornot_notifier/rails'
4
4
 
5
5
  class RailsInitializerTest < Test::Unit::TestCase
6
6
  include DefinesConstants
@@ -12,25 +12,25 @@ class RailsInitializerTest < Test::Unit::TestCase
12
12
  end
13
13
  end
14
14
  define_constant("Rails", rails)
15
- HoptoadNotifier::Rails.initialize
16
- assert_equal "RAILS LOGGER", HoptoadNotifier.logger
15
+ ErrornotNotifier::Rails.initialize
16
+ assert_equal "RAILS LOGGER", ErrornotNotifier.logger
17
17
  end
18
18
 
19
19
  should "trigger use of Rails' default logger if logger isn't set and Rails.logger doesn't exist" do
20
20
  define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
21
21
 
22
- HoptoadNotifier::Rails.initialize
23
- assert_equal "RAILS DEFAULT LOGGER", HoptoadNotifier.logger
22
+ ErrornotNotifier::Rails.initialize
23
+ assert_equal "RAILS DEFAULT LOGGER", ErrornotNotifier.logger
24
24
  end
25
25
 
26
26
  should "allow overriding of the logger if already assigned" do
27
27
  define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
28
- HoptoadNotifier::Rails.initialize
28
+ ErrornotNotifier::Rails.initialize
29
29
 
30
- HoptoadNotifier.configure(true) do |config|
30
+ ErrornotNotifier.configure(true) do |config|
31
31
  config.logger = "OVERRIDDEN LOGGER"
32
32
  end
33
33
 
34
- assert_equal "OVERRIDDEN LOGGER", HoptoadNotifier.logger
34
+ assert_equal "OVERRIDDEN LOGGER", ErrornotNotifier.logger
35
35
  end
36
36
  end
data/test/sender_test.rb CHANGED
@@ -7,15 +7,16 @@ class SenderTest < Test::Unit::TestCase
7
7
  end
8
8
 
9
9
  def build_sender(opts = {})
10
- config = HoptoadNotifier::Configuration.new
10
+ config = ErrornotNotifier::Configuration.new
11
+ config.host = 'localhost'
11
12
  opts.each {|opt, value| config.send(:"#{opt}=", value) }
12
- HoptoadNotifier::Sender.new(config)
13
+ ErrornotNotifier::Sender.new(config)
13
14
  end
14
15
 
15
16
  def send_exception(args = {})
16
17
  notice = args.delete(:notice) || build_notice_data
17
18
  sender = args.delete(:sender) || build_sender(args)
18
- sender.send_to_hoptoad(notice)
19
+ sender.send_to_errornot(notice)
19
20
  sender
20
21
  end
21
22
 
@@ -29,7 +30,7 @@ class SenderTest < Test::Unit::TestCase
29
30
  http
30
31
  end
31
32
 
32
- should "post to Hoptoad when using an HTTP proxy" do
33
+ should "post to Errornot when using an HTTP proxy" do
33
34
  response = stub(:body => 'body')
34
35
  http = stub(:post => response,
35
36
  :read_timeout= => nil,
@@ -38,7 +39,7 @@ class SenderTest < Test::Unit::TestCase
38
39
  proxy = stub(:new => http)
39
40
  Net::HTTP.stubs(:Proxy => proxy)
40
41
 
41
- url = "http://hoptoadapp.com:80#{HoptoadNotifier::Sender::NOTICES_URI}"
42
+ url = "http://hoptoadapp.com:80#{ErrornotNotifier::Sender::NOTICES_URI}"
42
43
  uri = URI.parse(url)
43
44
 
44
45
  proxy_host = 'some.host'
@@ -50,8 +51,8 @@ class SenderTest < Test::Unit::TestCase
50
51
  :proxy_port => proxy_port,
51
52
  :proxy_user => proxy_user,
52
53
  :proxy_pass => proxy_pass)
53
- assert_received(http, :post) do |expect|
54
- expect.with(uri.path, anything, HoptoadNotifier::HEADERS)
54
+ assert_received(http, :post) do |expect|
55
+ expect.with(uri.path, anything, ErrornotNotifier::HEADERS)
55
56
  end
56
57
  assert_received(Net::HTTP, :Proxy) do |expect|
57
58
  expect.with(proxy_host, proxy_port, proxy_user, proxy_pass)
@@ -60,16 +61,16 @@ class SenderTest < Test::Unit::TestCase
60
61
 
61
62
  should "post to the right url for non-ssl" do
62
63
  http = stub_http
63
- url = "http://hoptoadapp.com:80#{HoptoadNotifier::Sender::NOTICES_URI}"
64
+ url = "http://hoptoadapp.com:80#{ErrornotNotifier::Sender::NOTICES_URI}"
64
65
  uri = URI.parse(url)
65
66
  send_exception(:secure => false)
66
- assert_received(http, :post) {|expect| expect.with(uri.path, anything, HoptoadNotifier::HEADERS) }
67
+ assert_received(http, :post) {|expect| expect.with(uri.path, anything, ErrornotNotifier::HEADERS) }
67
68
  end
68
69
 
69
70
  should "post to the right path for ssl" do
70
71
  http = stub_http
71
72
  send_exception(:secure => true)
72
- assert_received(http, :post) {|expect| expect.with(HoptoadNotifier::Sender::NOTICES_URI, anything, HoptoadNotifier::HEADERS) }
73
+ assert_received(http, :post) {|expect| expect.with(ErrornotNotifier::Sender::NOTICES_URI, anything, ErrornotNotifier::HEADERS) }
73
74
  end
74
75
 
75
76
  should "default the open timeout to 2 seconds" do
@@ -99,13 +100,13 @@ class SenderTest < Test::Unit::TestCase
99
100
  should "connect to the right port for ssl" do
100
101
  stub_http
101
102
  send_exception(:secure => true)
102
- assert_received(Net::HTTP, :new) {|expect| expect.with("hoptoadapp.com", 443) }
103
+ assert_received(Net::HTTP, :new) {|expect| expect.with("localhost", 443) }
103
104
  end
104
105
 
105
106
  should "connect to the right port for non-ssl" do
106
107
  stub_http
107
108
  send_exception(:secure => false)
108
- assert_received(Net::HTTP, :new) {|expect| expect.with("hoptoadapp.com", 80) }
109
+ assert_received(Net::HTTP, :new) {|expect| expect.with("localhost", 80) }
109
110
  end
110
111
 
111
112
  should "use ssl if secure" do