mail_interceptor 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00ca7563318bdfe6a5a029d688a30a11389c6241
4
- data.tar.gz: 822c440a035866a071146d0c18ea8ae4cf0ca2f6
3
+ metadata.gz: f4be09e7c5f1f10c725f7a168226c6ee7e2a94a6
4
+ data.tar.gz: c3baf7087003d31f7c76f780cadf6b270ce83e74
5
5
  SHA512:
6
- metadata.gz: f9996e2846789d53d5e7bff41c2a1141b9655ad935450fab2e05fb88967633f6569632b7f3236a7f22b3f98d9391b449f2eb0dbd9236f9186591bdcc1e9a51c2
7
- data.tar.gz: d5a63b1210264f18dbae927675dbf0cf7a8e7b66033f0f7a326c68ae55ef2e072de486c6b5feccc4646c3dff0e9a950bf84c905c30ff85efeef606ae28e9048d
6
+ metadata.gz: ec4748f5019bd812171d9772aa17e7b503eb4b98bd0f6f2ffe83fd9b22477f880191fc1d309ed6d346f20298614e8eb18b61e07aec420e6a0c370ea3933853b1
7
+ data.tar.gz: d98e76bc4afce44fbda3039769f8319a61bb1c91f8e1fdc438ee4a844a8d614895896f4ce5d7acb81517a5cbc55ac698d1d8c521bdb2aac26561f0dcd3ab6b23
data/README.md CHANGED
@@ -79,6 +79,12 @@ MailInterceptor::Interceptor.new({ forward_emails_to: ['intercepted_emails@bigbi
79
79
  'qa@bigbinary.com' })
80
80
  ```
81
81
 
82
+ ### ignore_bcc and ignore_cc
83
+
84
+ By default bcc and cc are ignored.
85
+ You can pass `:ignore_bcc` or `:ignore_cc` options as `false`,
86
+ if you don't want to ignore bcc or cc.
87
+
82
88
  ### Custom environment
83
89
 
84
90
  By default all emails sent in non production environment are
@@ -112,5 +118,4 @@ MailInterceptor::Interceptor.new({ env: MyEnv.new,
112
118
  ```
113
119
 
114
120
  #### Brought to you by
115
-
116
- [![BigBinary logo](http://bigbinary.com/assets/common/logo.png)](http://BigBinary.com)
121
+ <a href='http://BigBinary.com'><img src="https://s3.amazonaws.com/bigbinary-media/horizontal/logo_blue.png" width="200px"/></a>
@@ -4,18 +4,22 @@ require "mail_interceptor/version"
4
4
 
5
5
  module MailInterceptor
6
6
  class Interceptor
7
- attr_accessor :deliver_emails_to, :forward_emails_to, :env
7
+ attr_accessor :deliver_emails_to, :forward_emails_to, :env, :ignore_cc, :ignore_bcc
8
8
 
9
9
  def initialize options = {}
10
10
  @deliver_emails_to = Array.wrap options[:deliver_emails_to]
11
11
  @forward_emails_to = options.fetch :forward_emails_to
12
+ @ignore_cc = options.fetch :ignore_cc, true
13
+ @ignore_bcc = options.fetch :ignore_bcc, true
12
14
  @env = options.fetch :env, InterceptorEnv.new
13
15
 
14
16
  sanitize_forward_emails_to
15
17
  end
16
18
 
17
19
  def delivering_email message
18
- message.to = normalize_recipients(message.to).flatten.uniq
20
+ message.to = normalize_recipients(message.to).flatten.uniq
21
+ message.cc = [] if ignore_cc
22
+ message.bcc = [] if ignore_bcc
19
23
  end
20
24
 
21
25
  private
@@ -1,3 +1,3 @@
1
1
  module MailInterceptor
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -61,6 +61,28 @@ class MailInterceptorTest < Minitest::Test
61
61
  assert_equal message, exception.message
62
62
  end
63
63
 
64
+ def test_default_ignore_bcc_and_cc
65
+ interceptor = ::MailInterceptor::Interceptor.new env: env,
66
+ forward_emails_to: 'test@example.com'
67
+ @message.bcc = ['bcc@example.com']
68
+ @message.cc = ['cc@example.com']
69
+ interceptor.delivering_email @message
70
+ assert_equal [], @message.bcc
71
+ assert_equal [], @message.cc
72
+ end
73
+
74
+ def test_do_not_ignore_bcc_or_cc
75
+ interceptor = ::MailInterceptor::Interceptor.new env: env,
76
+ forward_emails_to: 'test@example.com',
77
+ ignore_bcc: false,
78
+ ignore_cc: false
79
+ @message.bcc = ['bcc@example.com']
80
+ @message.cc = ['cc@example.com']
81
+ interceptor.delivering_email @message
82
+ assert_equal ['bcc@example.com'], @message.bcc
83
+ assert_equal ['cc@example.com'], @message.cc
84
+ end
85
+
64
86
  private
65
87
 
66
88
  def env(environment = 'test')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_interceptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neeraj Singh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-22 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.4.5
119
+ rubygems_version: 2.5.1
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Intercepts and forwards emails in non production environment