exception_no 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjQyYjlkYmY3YzFhN2I3MDVkM2U0YzkyOWMwZTRlODg2YWIxNmEzYw==
4
+ ODJlYTU1M2UyY2RmZjJjMzgyN2E1ZjIwMjcyYmNjNGZmMTFiYzhjMQ==
5
5
  data.tar.gz: !binary |-
6
- NjVhMTMxZGFkYWFmOTNiYTY4NjE1MDMzMjMwODc1NGMwMTAwYzY5Yw==
6
+ NDc5Y2Y2OWI1OWI0YmQ3YTE5YTEzZTgzMGExNTM2M2RlMGYwMDY5NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjU2NWIyZmUxY2U5Y2MyYTcxODVmMTAwOTY4MTE3NzhiZDYxNzllODgxNDJh
10
- NzIxNTU1M2U4NmZmMTE5MWYzZmZjMmNiNWE1OWFlZjA1ZmE4ZGE0M2IxMjY2
11
- YzcyZjhlZWU3ZDBhOWQxNzczZDcyM2RjNDNiMmJjZDE3ZDM3OWE=
9
+ OGNiMTBlNmU3OTFiYjM5Mjg5OTQ5ZDMyNzczZWM4MjhmMGFiNTljNzQzMzgz
10
+ YzA2OGQwY2Y0ZDUzMTIxNTQzYzgxZjhkN2YyOGQyMDNiNzNkN2Y0YTZlYWQy
11
+ MDBkNzJjZDE1MjA4ZDJhMTYwMTE4ODExZDA4YjE5NjliMzdhMzU=
12
12
  data.tar.gz: !binary |-
13
- NGM1Zjg3YzgxYmJhNzMwNzNjOTQxMTlhNDJiMTc2NTU4YWE3YTc1MDNhN2Jk
14
- OTIxZjQ3Yzk3YTZhNjg4OWY0ZjQxNTgwZjcxZjg5ZGFlYjg2OTE0ODdmYTZm
15
- NjQ4MDg2NWY3M2M4OGZlYTFlZDY0NWRiOGI3NzhjNzE2OGI3NjY=
13
+ NTdhNTUwYmZmNDg1ZTFlZTVlMmFkZGNiZDEyYzM2MWIwZmRhY2Y0Y2YyOWFk
14
+ NGY2MTYwNmFjNTFkMDk0NTdjYTQ3NzQ0MmEzYzc4YjczZDc2MzgyNzYwY2Iw
15
+ MjlmMDZmZjI5ZmE5MjRkZWU3N2NiZTQyOTEzNzQwMDE3NTlmOTU=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 0.0.3 - 2013-09-18
2
+ ==================
3
+
4
+ * `ExceptionNo#deliver` can be used to control whether or not to send email
5
+ notifications. Typically useful in a non-production environment.
6
+
1
7
  0.0.2 - 2013-09-17
2
8
  ==================
3
9
 
data/lib/exception_no.rb CHANGED
@@ -2,13 +2,15 @@ require "net/smtp"
2
2
  require "erb"
3
3
 
4
4
  class ExceptionNo
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.3"
6
6
 
7
7
  attr_accessor :backtrace_filter
8
+ attr_accessor :deliver
8
9
 
9
10
  def initialize(config = {})
10
11
  @config = config
11
12
  @template = ERB.new(TEMPLATE)
13
+ @deliver = true
12
14
 
13
15
  @backtrace_filter = -> line { true }
14
16
  end
@@ -22,6 +24,8 @@ class ExceptionNo
22
24
  end
23
25
 
24
26
  def notify(exception, options = {})
27
+ return unless @deliver
28
+
25
29
  begin
26
30
  _notify(exception, options)
27
31
  rescue => notification_error
data/test/exception_no.rb CHANGED
@@ -63,5 +63,13 @@ test "allows to filter the backtrace" do |notifier|
63
63
  assert !body.include?(Gem.path.first)
64
64
  end
65
65
 
66
+ test "disable delivery" do |notifier|
67
+ notifier.deliver = false
68
+
69
+ notifier.notify(ArgumentError.new)
70
+
71
+ assert_equal $smtp.outbox.size, 0
72
+ end
73
+
66
74
  $smtp.stop
67
75
  $smtp.join
data/test/prelude.rb CHANGED
@@ -48,6 +48,10 @@ def capture_stderr
48
48
  end
49
49
  end
50
50
 
51
+ prepare do
52
+ $smtp.outbox.clear
53
+ end
54
+
51
55
  $smtp = SMTPServer.new(2525, "127.0.0.1")
52
56
  $smtp.start
53
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_no
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Educabilia