email_blacklist 0.1.0 → 0.1.1

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.
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+ *.gemspec
@@ -7,6 +7,11 @@ This is useful in a variety of situations:
7
7
  * You can stop emails from being sent to users who have deactivated their accounts with your app.
8
8
  * Any other reason you might want to stop emails from being sent...
9
9
 
10
+ When an email address is blacklisted, no ActionMailer emails will be sent to it, regardless of
11
+ if the email addresses is used for the to, cc or bcc fields. However, if there are additional
12
+ email addresses on the same email that are not blacklisted, the email will still be sent to them.
13
+ If all email addresses for a particular email are blacklisted, the email will not be sent at all.
14
+
10
15
  == Installation
11
16
  gem install email_blacklist
12
17
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,6 +5,8 @@ module EmailBlacklist
5
5
  ADDRESS_TYPES = [:to, :cc, :bcc].freeze
6
6
 
7
7
  class Config
8
+ @@blacklist_block = nil
9
+
8
10
  class << self
9
11
  def blacklist(&blk)
10
12
  @@blacklist_block = blk
@@ -31,7 +33,7 @@ ActionMailer::Base.class_eval do
31
33
  mail.send("#{address_type}=", addresses)
32
34
  end
33
35
 
34
- return if all_addresses.flatten.compact.empty?
36
+ return mail if all_addresses.flatten.compact.empty?
35
37
  end
36
38
 
37
39
  super(mail)
@@ -65,12 +65,16 @@ describe ActionMailer do
65
65
  context "sending an email to just 'bob@blacklisted.org'" do
66
66
  before(:each) do
67
67
  ActionMailer::Base.deliveries.clear
68
- TestMailer.deliver_email({:to => 'bob@blacklisted.org'})
68
+ @email = TestMailer.deliver_email({:to => 'bob@blacklisted.org'})
69
69
  end
70
70
 
71
71
  it "should not send the email at all" do
72
72
  ActionMailer::Base.deliveries.should == []
73
73
  end
74
+
75
+ it "should still return the email" do
76
+ @email.should_not be_nil
77
+ end
74
78
  end
75
79
  end
76
80
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_blacklist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston