sanitize_email 1.0.0.rc1 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.travis.yml +8 -0
- data/CHANGELOG +14 -0
- data/Gemfile +2 -13
- data/Gemfile.lock +34 -26
- data/{MIT-LICENSE → LICENSE} +3 -1
- data/README.rdoc +3 -3
- data/Rakefile +2 -24
- data/lib/sanitize_email.rb +4 -4
- data/lib/sanitize_email/config.rb +6 -2
- data/lib/sanitize_email/engine.rb +1 -1
- data/lib/sanitize_email/railtie.rb +1 -1
- data/lib/sanitize_email/version.rb +1 -1
- data/sanitize_email.gemspec +14 -30
- data/spec/sanitize_email_spec.rb +14 -9
- data/spec/spec_helper.rb +13 -1
- metadata +32 -14
- data/VERSION.yml +0 -5
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
Version 1.0.0.rc3 - AUG.08.2012
|
2
|
+
- Forgot to switch from jeweler to gem-release, so making appropriate changes and bumping again
|
3
|
+
- Aligning closer to bundler gem defaults
|
4
|
+
- Removing Rails dependency - Should work with Sinatra, or any Mail-like interface
|
5
|
+
- Added facets dependency to get cattr functionality (and hopefully other cool stuff)
|
6
|
+
- Gem dependencies in gemspec
|
7
|
+
|
8
|
+
|
9
|
+
Version 1.0.0.rc2 - AUG.08.2012 - botched
|
10
|
+
- Bug: loading the gem in a rails app broke mailer specs in the app - Fixed
|
11
|
+
- https://github.com/pboling/sanitize_email/issues/4
|
12
|
+
- Moved MIT-LICENSE to LICENSE, updated years
|
13
|
+
- Added Travis-CI for... CI.
|
14
|
+
|
1
15
|
Version 1.0.0.rc1
|
2
16
|
- Added a good_list and a bad_list (whitelist and blacklist)
|
3
17
|
- Added Deprecation library
|
data/Gemfile
CHANGED
@@ -1,15 +1,4 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
group :development, :test do
|
7
|
-
gem 'jeweler'
|
8
|
-
gem 'letter_opener'
|
9
|
-
gem 'launchy'
|
10
|
-
gem 'rspec'
|
11
|
-
gem 'mail'
|
12
|
-
gem 'rdoc', '>= 3.12'
|
13
|
-
gem 'reek', '>= 1.2.8'
|
14
|
-
gem 'roodi', '>= 2.1.0'
|
15
|
-
end
|
3
|
+
# Specify your gem's dependencies in mygem.gemspec
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,37 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sanitize_email (1.0.0.rc2)
|
5
|
+
facets (> 0)
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: http://rubygems.org/
|
3
9
|
specs:
|
4
|
-
actionmailer (3.2.
|
5
|
-
actionpack (= 3.2.
|
10
|
+
actionmailer (3.2.7)
|
11
|
+
actionpack (= 3.2.7)
|
6
12
|
mail (~> 2.4.4)
|
7
|
-
actionpack (3.2.
|
8
|
-
activemodel (= 3.2.
|
9
|
-
activesupport (= 3.2.
|
13
|
+
actionpack (3.2.7)
|
14
|
+
activemodel (= 3.2.7)
|
15
|
+
activesupport (= 3.2.7)
|
10
16
|
builder (~> 3.0.0)
|
11
17
|
erubis (~> 2.7.0)
|
12
|
-
journey (~> 1.0.
|
18
|
+
journey (~> 1.0.4)
|
13
19
|
rack (~> 1.4.0)
|
14
20
|
rack-cache (~> 1.2)
|
15
21
|
rack-test (~> 0.6.1)
|
16
22
|
sprockets (~> 2.1.3)
|
17
|
-
activemodel (3.2.
|
18
|
-
activesupport (= 3.2.
|
23
|
+
activemodel (3.2.7)
|
24
|
+
activesupport (= 3.2.7)
|
19
25
|
builder (~> 3.0.0)
|
20
|
-
activerecord (3.2.
|
21
|
-
activemodel (= 3.2.
|
22
|
-
activesupport (= 3.2.
|
26
|
+
activerecord (3.2.7)
|
27
|
+
activemodel (= 3.2.7)
|
28
|
+
activesupport (= 3.2.7)
|
23
29
|
arel (~> 3.0.2)
|
24
30
|
tzinfo (~> 0.3.29)
|
25
|
-
activeresource (3.2.
|
26
|
-
activemodel (= 3.2.
|
27
|
-
activesupport (= 3.2.
|
28
|
-
activesupport (3.2.
|
31
|
+
activeresource (3.2.7)
|
32
|
+
activemodel (= 3.2.7)
|
33
|
+
activesupport (= 3.2.7)
|
34
|
+
activesupport (3.2.7)
|
29
35
|
i18n (~> 0.6)
|
30
36
|
multi_json (~> 1.0)
|
31
37
|
addressable (2.2.8)
|
@@ -33,6 +39,7 @@ GEM
|
|
33
39
|
builder (3.0.0)
|
34
40
|
diff-lcs (1.1.3)
|
35
41
|
erubis (2.7.0)
|
42
|
+
facets (2.9.3)
|
36
43
|
git (1.2.5)
|
37
44
|
hike (1.2.1)
|
38
45
|
i18n (0.6.0)
|
@@ -61,17 +68,17 @@ GEM
|
|
61
68
|
rack
|
62
69
|
rack-test (0.6.1)
|
63
70
|
rack (>= 1.0)
|
64
|
-
rails (3.2.
|
65
|
-
actionmailer (= 3.2.
|
66
|
-
actionpack (= 3.2.
|
67
|
-
activerecord (= 3.2.
|
68
|
-
activeresource (= 3.2.
|
69
|
-
activesupport (= 3.2.
|
71
|
+
rails (3.2.7)
|
72
|
+
actionmailer (= 3.2.7)
|
73
|
+
actionpack (= 3.2.7)
|
74
|
+
activerecord (= 3.2.7)
|
75
|
+
activeresource (= 3.2.7)
|
76
|
+
activesupport (= 3.2.7)
|
70
77
|
bundler (~> 1.0)
|
71
|
-
railties (= 3.2.
|
72
|
-
railties (3.2.
|
73
|
-
actionpack (= 3.2.
|
74
|
-
activesupport (= 3.2.
|
78
|
+
railties (= 3.2.7)
|
79
|
+
railties (3.2.7)
|
80
|
+
actionpack (= 3.2.7)
|
81
|
+
activesupport (= 3.2.7)
|
75
82
|
rack-ssl (~> 1.3.2)
|
76
83
|
rake (>= 0.8.7)
|
77
84
|
rdoc (~> 3.4)
|
@@ -106,7 +113,7 @@ GEM
|
|
106
113
|
hike (~> 1.2)
|
107
114
|
rack (~> 1.0)
|
108
115
|
tilt (~> 1.1, != 1.3.0)
|
109
|
-
thor (0.15.
|
116
|
+
thor (0.15.4)
|
110
117
|
tilt (1.3.3)
|
111
118
|
treetop (1.4.10)
|
112
119
|
polyglot
|
@@ -127,3 +134,4 @@ DEPENDENCIES
|
|
127
134
|
reek (>= 1.2.8)
|
128
135
|
roodi (>= 2.1.0)
|
129
136
|
rspec
|
137
|
+
sanitize_email!
|
data/{MIT-LICENSE → LICENSE}
RENAMED
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
= sanitize_email
|
1
|
+
= sanitize_email {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/pboling/sanitize_email]
|
2
2
|
|
3
3
|
This gem allows you to globally override your mail delivery settings. It's particularly helpful when you want to omit the delivery of email (e.g. in development/test environments) or alter the to/cc/bcc (e.g. in staging or demo environments) of all email generated from your application.
|
4
4
|
|
5
5
|
It is a "configure it and forget it" type gem that requires very little setup. It includes some very innocuous monkey patching of ActionMailer::Base to work its magic.
|
6
6
|
|
7
|
-
It currently solves five (3!) common problems in ruby web applications that use ActionMailer:
|
7
|
+
It currently solves five (3!) common problems in ruby web applications that use ActionMailer, or the Mail gem, or anything that follows Mailer's register_interceptor pattern:
|
8
8
|
|
9
9
|
=== Working Locally with Production Data
|
10
10
|
|
@@ -35,7 +35,7 @@ Customize and add to an initializer:
|
|
35
35
|
config[:sanitized_recipients] = 'to@sanitize_email.org'
|
36
36
|
config[:sanitized_bcc] = 'bcc@sanitize_email.org'
|
37
37
|
config[:sanitized_cc] = 'cc@sanitize_email.org'
|
38
|
-
config[:
|
38
|
+
config[:local_environment_proc] = Proc.new { %w(development test).include?(Rails.env) }
|
39
39
|
config[:use_actual_email_prepended_to_subject] = true # or false
|
40
40
|
config[:use_actual_email_as_sanitized_user_name] = true # or false
|
41
41
|
end
|
data/Rakefile
CHANGED
@@ -1,30 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
require
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
2
|
+
#!/usr/bin/env rake
|
3
|
+
require "bundler/gem_tasks"
|
12
4
|
require 'rake'
|
13
5
|
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "sanitize_email"
|
18
|
-
gem.homepage = "http://github.com/pboling/sanitize_email"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %q{Test an application's email abilities without ever sending a message to actual live addresses}
|
21
|
-
gem.description = "Tool to aid in development, testing, qa, and production troubleshooting of email issues without worrying that emails will get sent to actual live addresses."
|
22
|
-
gem.email = ['peter.boling@gmail.com', 'jtrupiano@gmail.com', 'george@benevolentcode.com']
|
23
|
-
gem.authors = ["Peter Boling", "John Trupiano", "George Anderson"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
6
|
require 'rspec/core'
|
29
7
|
require 'rspec/core/rake_task'
|
30
8
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
data/lib/sanitize_email.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#Copyright (c) 2008-12 Peter H. Boling of 9thBit LLC
|
2
2
|
#Released under the MIT license
|
3
|
-
require 'rails'
|
4
|
-
require 'action_mailer'
|
5
3
|
|
6
4
|
module SanitizeEmail
|
7
5
|
require 'sanitize_email/version'
|
@@ -10,14 +8,16 @@ module SanitizeEmail
|
|
10
8
|
require 'sanitize_email/deprecation'
|
11
9
|
|
12
10
|
# Allow non-rails implementations to use this gem
|
13
|
-
if
|
11
|
+
if defined?(Rails) && ::Rails::VERSION::MAJOR >= 3
|
14
12
|
if ::Rails::VERSION::MINOR >= 1
|
15
13
|
require 'sanitize_email/engine'
|
16
14
|
elsif ::Rails::VERSION::MINOR == 0
|
17
15
|
require 'sanitize_email/railtie'
|
18
16
|
end
|
19
|
-
elsif
|
17
|
+
elsif defined?(Rails)
|
20
18
|
raise "Please use the 0.X.X versions of sanitize_email for Rails 2.X and below."
|
19
|
+
elsif defined?(Mailer) && Mailer.respond_to?(:register_interceptor)
|
20
|
+
Mailer.register_interceptor(SanitizeEmail::Bleach.new)
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.[](key)
|
@@ -1,6 +1,11 @@
|
|
1
|
+
require 'facets/module/mattr' # gives cattr
|
2
|
+
|
1
3
|
module SanitizeEmail
|
2
4
|
class Config
|
3
|
-
|
5
|
+
|
6
|
+
cattr_reader :config
|
7
|
+
cattr_writer :config
|
8
|
+
|
4
9
|
self.config ||= {
|
5
10
|
# Adds the following class attributes to the classes that include NinthBit::SanitizeEmail
|
6
11
|
:force_sanitize => nil,
|
@@ -31,7 +36,6 @@ module SanitizeEmail
|
|
31
36
|
|
32
37
|
:local_environment_proc => Proc.new { true }
|
33
38
|
}
|
34
|
-
|
35
39
|
def self.configure &block
|
36
40
|
yield self.config
|
37
41
|
|
data/sanitize_email.gemspec
CHANGED
@@ -1,53 +1,35 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/sanitize_email/version', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
5
|
s.name = "sanitize_email"
|
8
|
-
s.version =
|
6
|
+
s.version = SanitizeEmail::VERSION
|
9
7
|
|
10
8
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
9
|
s.authors = ["Peter Boling", "John Trupiano", "George Anderson"]
|
12
|
-
s.date = "2012-08-
|
13
|
-
s.
|
10
|
+
s.date = "2012-08-08"
|
11
|
+
s.summary = "In Rails, Sinatra, or any framework using a Mail-like API: Test an application's email abilities without ever sending a message to actual live addresses"
|
12
|
+
s.description = "In Rails, Sinatra, or any framework using a Mail-like API: Aids in development, testing, qa, and production troubleshooting of email issues without worrying that emails will get sent to actual live addresses."
|
14
13
|
s.email = ["peter.boling@gmail.com", "jtrupiano@gmail.com", "george@benevolentcode.com"]
|
15
14
|
s.extra_rdoc_files = [
|
15
|
+
"LICENSE",
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
|
-
s.files
|
19
|
-
|
20
|
-
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"MIT-LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION.yml",
|
27
|
-
"init.rb",
|
28
|
-
"lib/sanitize_email.rb",
|
29
|
-
"lib/sanitize_email/bleach.rb",
|
30
|
-
"lib/sanitize_email/config.rb",
|
31
|
-
"lib/sanitize_email/deprecation.rb",
|
32
|
-
"lib/sanitize_email/engine.rb",
|
33
|
-
"lib/sanitize_email/railtie.rb",
|
34
|
-
"lib/sanitize_email/version.rb",
|
35
|
-
"sanitize_email.gemspec",
|
36
|
-
"spec/sanitize_email_spec.rb",
|
37
|
-
"spec/spec_helper.rb"
|
38
|
-
]
|
18
|
+
s.files = `git ls-files`.split($\)
|
19
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
39
21
|
s.homepage = "http://github.com/pboling/sanitize_email"
|
40
22
|
s.licenses = ["MIT"]
|
41
23
|
s.require_paths = ["lib"]
|
42
24
|
s.rubygems_version = "1.8.24"
|
43
|
-
s.summary = "Test an application's email abilities without ever sending a message to actual live addresses"
|
44
25
|
|
45
26
|
if s.respond_to? :specification_version then
|
46
27
|
s.specification_version = 3
|
47
28
|
|
48
29
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
-
s.add_runtime_dependency(%q<
|
50
|
-
s.
|
30
|
+
s.add_runtime_dependency(%q<facets>, ["> 0"]) # to replace the cattr_accessor method we lost when removing rails
|
31
|
+
s.add_development_dependency(%q<rails>, ["> 3"])
|
32
|
+
s.add_development_dependency(%q<actionmailer>, ["> 3"])
|
51
33
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
52
34
|
s.add_development_dependency(%q<letter_opener>, [">= 0"])
|
53
35
|
s.add_development_dependency(%q<launchy>, [">= 0"])
|
@@ -57,6 +39,7 @@ Gem::Specification.new do |s|
|
|
57
39
|
s.add_development_dependency(%q<reek>, [">= 1.2.8"])
|
58
40
|
s.add_development_dependency(%q<roodi>, [">= 2.1.0"])
|
59
41
|
else
|
42
|
+
s.add_dependency(%q<facets>, ["> 0"]) # to replace the cattr_accessor method we lost when removing rails
|
60
43
|
s.add_dependency(%q<rails>, ["> 3"])
|
61
44
|
s.add_dependency(%q<actionmailer>, ["> 3"])
|
62
45
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
@@ -69,6 +52,7 @@ Gem::Specification.new do |s|
|
|
69
52
|
s.add_dependency(%q<roodi>, [">= 2.1.0"])
|
70
53
|
end
|
71
54
|
else
|
55
|
+
s.add_dependency(%q<facets>, ["> 0"]) # to replace the cattr_accessor method we lost when removing rails
|
72
56
|
s.add_dependency(%q<rails>, ["> 3"])
|
73
57
|
s.add_dependency(%q<actionmailer>, ["> 3"])
|
74
58
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
data/spec/sanitize_email_spec.rb
CHANGED
@@ -25,18 +25,20 @@ describe SanitizeEmail do
|
|
25
25
|
Mail.defaults do
|
26
26
|
delivery_method LetterOpener::DeliveryMethod, :location => location
|
27
27
|
end
|
28
|
+
|
28
29
|
Rails.stub(:env).and_return(rails_env)
|
29
30
|
@location = location
|
30
31
|
end
|
31
32
|
|
32
33
|
def configure_sanitize_email(sanitize_hash = {})
|
33
|
-
|
34
|
+
defaults = {
|
34
35
|
:sanitized_to => 'to@sanitize_email.org',
|
35
36
|
:sanitized_cc => 'cc@sanitize_email.org',
|
36
37
|
:sanitized_bcc => 'bcc@sanitize_email.org',
|
37
38
|
:use_actual_email_prepended_to_subject => true,
|
38
39
|
:use_actual_email_as_sanitized_user_name => true
|
39
|
-
}
|
40
|
+
}
|
41
|
+
sanitize_hash = defaults.merge(sanitize_hash)
|
40
42
|
SanitizeEmail::Config.configure do |config|
|
41
43
|
config[:sanitized_to] = sanitize_hash[:sanitized_to]
|
42
44
|
config[:sanitized_cc] = sanitize_hash[:sanitized_cc]
|
@@ -50,9 +52,12 @@ describe SanitizeEmail do
|
|
50
52
|
Mail.register_interceptor(SanitizeEmail::Bleach.new)
|
51
53
|
end
|
52
54
|
|
53
|
-
def sanitized_mail_delivery(
|
55
|
+
def sanitized_mail_delivery(options = {})
|
56
|
+
unless options.has_key?(:force_sanitize)
|
57
|
+
options[:force_sanitize] = false
|
58
|
+
end
|
54
59
|
# Ensure that localish? will return sanitization_switch if true or false, and use proc when nil
|
55
|
-
SanitizeEmail::Config.config[:force_sanitize] =
|
60
|
+
SanitizeEmail::Config.config[:force_sanitize] = options[:force_sanitize]
|
56
61
|
Launchy.should_receive(:open)
|
57
62
|
@mail_message = Mail.deliver do
|
58
63
|
from 'from@example.org'
|
@@ -75,7 +80,7 @@ describe SanitizeEmail do
|
|
75
80
|
|
76
81
|
context "false" do
|
77
82
|
it "alters nothing" do
|
78
|
-
sanitized_mail_delivery(false)
|
83
|
+
sanitized_mail_delivery(:force_sanitize => false)
|
79
84
|
@email_file.should have_from("from@example.org")
|
80
85
|
@email_file.should have_to("to@example.org")
|
81
86
|
@mail_message.header.fields[3].value.should_not have_to("to at example.org")
|
@@ -87,7 +92,7 @@ describe SanitizeEmail do
|
|
87
92
|
|
88
93
|
context "true" do
|
89
94
|
it "should override" do
|
90
|
-
sanitized_mail_delivery(true)
|
95
|
+
sanitized_mail_delivery(:force_sanitize => true)
|
91
96
|
@email_file.should have_from("from@example.org")
|
92
97
|
#puts "@mail_message.header.fields[3]: #{@mail_message.header.fields[3]}"
|
93
98
|
#@mail_message.header.fields[3].value.should have_to("to at example.org")
|
@@ -104,7 +109,7 @@ describe SanitizeEmail do
|
|
104
109
|
sanitize_spec_dryer('test')
|
105
110
|
configure_sanitize_email({:local_environments => ['test']})
|
106
111
|
SanitizeEmail[:local_environment_proc].call.should == true
|
107
|
-
sanitized_mail_delivery(nil)
|
112
|
+
sanitized_mail_delivery(:force_sanitize => nil)
|
108
113
|
@email_file.should have_to("to@sanitize_email.org")
|
109
114
|
@email_file.should have_subject("(to at example.org) original subject")
|
110
115
|
end
|
@@ -112,7 +117,7 @@ describe SanitizeEmail do
|
|
112
117
|
sanitize_spec_dryer('production')
|
113
118
|
configure_sanitize_email({:local_environments => ['development']}) # Won't match!
|
114
119
|
SanitizeEmail[:local_environment_proc].call.should == false
|
115
|
-
sanitized_mail_delivery(nil)
|
120
|
+
sanitized_mail_delivery(:force_sanitize => nil)
|
116
121
|
@mail_message.should_not have_subject("to at example.org")
|
117
122
|
end
|
118
123
|
end
|
@@ -123,7 +128,7 @@ describe SanitizeEmail do
|
|
123
128
|
configure_sanitize_email({:sanitized_recipients => 'barney@sanitize_email.org'})
|
124
129
|
end
|
125
130
|
it "used as sanitized_to" do
|
126
|
-
sanitized_mail_delivery(true)
|
131
|
+
sanitized_mail_delivery(:force_sanitize => true)
|
127
132
|
@email_file.should have_from("from@example.org")
|
128
133
|
@mail_message.should have_to("to@sanitize_email.org")
|
129
134
|
@email_file.should have_subject("(to at example.org) original subject")
|
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,18 @@ module EmailMatcherHelpers
|
|
17
17
|
# Sweet, nourishing recursion
|
18
18
|
def email_matching(matcher, part, mail_or_part)
|
19
19
|
if mail_or_part.respond_to?(part)
|
20
|
-
|
20
|
+
# within rspec objects sometimes respond_to all sorts of odd methods they don't really have,
|
21
|
+
# raising an argument error when called
|
22
|
+
# Need to write a failing spec for rspec I think to figure out where this is stemming from
|
23
|
+
begin
|
24
|
+
email_matching(matcher, part, mail_or_part.send(part))
|
25
|
+
rescue ArgumentError
|
26
|
+
if mail_or_part.respond_to?(:=~)
|
27
|
+
mail_or_part =~ Regexp.new(Regexp.escape(matcher))
|
28
|
+
else
|
29
|
+
raise UnexpectedMailType, "Cannot match #{matcher} for #{part}"
|
30
|
+
end
|
31
|
+
end
|
21
32
|
elsif mail_or_part.respond_to?(:join)
|
22
33
|
email_matching(matcher, part, mail_or_part.join(', '))
|
23
34
|
elsif mail_or_part.respond_to?(:=~) # Can we match a regex against it?
|
@@ -32,6 +43,7 @@ end
|
|
32
43
|
RSpec::Matchers.define :have_from do |from|
|
33
44
|
include EmailMatcherHelpers
|
34
45
|
match do |container|
|
46
|
+
#puts "container: #{container}"
|
35
47
|
email_matching(from, :from, container)
|
36
48
|
end
|
37
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanitize_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc3
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,8 +11,24 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-08-
|
14
|
+
date: 2012-08-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: facets
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>'
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>'
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
16
32
|
- !ruby/object:Gem::Dependency
|
17
33
|
name: rails
|
18
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -21,7 +37,7 @@ dependencies:
|
|
21
37
|
- - ! '>'
|
22
38
|
- !ruby/object:Gem::Version
|
23
39
|
version: '3'
|
24
|
-
type: :
|
40
|
+
type: :development
|
25
41
|
prerelease: false
|
26
42
|
version_requirements: !ruby/object:Gem::Requirement
|
27
43
|
none: false
|
@@ -37,7 +53,7 @@ dependencies:
|
|
37
53
|
- - ! '>'
|
38
54
|
- !ruby/object:Gem::Version
|
39
55
|
version: '3'
|
40
|
-
type: :
|
56
|
+
type: :development
|
41
57
|
prerelease: false
|
42
58
|
version_requirements: !ruby/object:Gem::Requirement
|
43
59
|
none: false
|
@@ -173,8 +189,9 @@ dependencies:
|
|
173
189
|
- - ! '>='
|
174
190
|
- !ruby/object:Gem::Version
|
175
191
|
version: 2.1.0
|
176
|
-
description:
|
177
|
-
|
192
|
+
description: ! 'In Rails, Sinatra, or any framework using a Mail-like API: Aids in
|
193
|
+
development, testing, qa, and production troubleshooting of email issues without
|
194
|
+
worrying that emails will get sent to actual live addresses.'
|
178
195
|
email:
|
179
196
|
- peter.boling@gmail.com
|
180
197
|
- jtrupiano@gmail.com
|
@@ -182,16 +199,18 @@ email:
|
|
182
199
|
executables: []
|
183
200
|
extensions: []
|
184
201
|
extra_rdoc_files:
|
202
|
+
- LICENSE
|
185
203
|
- README.rdoc
|
186
204
|
files:
|
205
|
+
- .gitignore
|
187
206
|
- .rspec
|
207
|
+
- .travis.yml
|
188
208
|
- CHANGELOG
|
189
209
|
- Gemfile
|
190
210
|
- Gemfile.lock
|
191
|
-
-
|
211
|
+
- LICENSE
|
192
212
|
- README.rdoc
|
193
213
|
- Rakefile
|
194
|
-
- VERSION.yml
|
195
214
|
- init.rb
|
196
215
|
- lib/sanitize_email.rb
|
197
216
|
- lib/sanitize_email/bleach.rb
|
@@ -216,9 +235,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
235
|
- - ! '>='
|
217
236
|
- !ruby/object:Gem::Version
|
218
237
|
version: '0'
|
219
|
-
segments:
|
220
|
-
- 0
|
221
|
-
hash: -2863798588423167662
|
222
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
239
|
none: false
|
224
240
|
requirements:
|
@@ -230,6 +246,8 @@ rubyforge_project:
|
|
230
246
|
rubygems_version: 1.8.24
|
231
247
|
signing_key:
|
232
248
|
specification_version: 3
|
233
|
-
summary:
|
234
|
-
live addresses
|
235
|
-
test_files:
|
249
|
+
summary: ! 'In Rails, Sinatra, or any framework using a Mail-like API: Test an application''s
|
250
|
+
email abilities without ever sending a message to actual live addresses'
|
251
|
+
test_files:
|
252
|
+
- spec/sanitize_email_spec.rb
|
253
|
+
- spec/spec_helper.rb
|