mail_safe 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Myron Marston
1
+ Copyright (c) 2009-2010 Myron Marston
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -69,14 +69,12 @@ When mail safe replaces an email address, it appends a notice to the bottom of t
69
69
 
70
70
  **************************************************
71
71
 
72
- == Version Compatibility
72
+ == Version Compatibility and Continuous Integration
73
73
 
74
- specs.should pass if RUBY_VERSION =~ /^1.(8.6|8.7|9.1)$/ && Rails.version =~ /^(1.2.6|2.\d.\d|3.0.0.beta)$/
75
-
76
- == Continuous Integration
77
-
78
- You can see the current status of the spec suite, for Ruby 1.8.6 and 1.9.1, on {runcoderun.org}[http://runcoderun.com/myronmarston/mail_safe].
74
+ Mail safe works on ruby {1.8.6}[http://integrity186.heroku.com/mail-safe], {1.8.7}[http://integrity187.heroku.com/mail-safe] and {1.9.1}[http://integrity191.heroku.com/mail-safe],
75
+ and any version of actionmailer since 1.3.6 (the version used by rails 1.2.6), including 3.0.0. The builds (linked to above)
76
+ use {ginger}[http://github.com/freelancing-god/ginger] to run the specs against 16 different versions of actionmailer.
79
77
 
80
78
  == Copyright
81
79
 
82
- Copyright (c) 2009 Myron Marston, Kashless.org. See LICENSE for details.
80
+ Copyright (c) 2009-2010 Myron Marston, Kashless.org. See LICENSE for details.
data/Rakefile CHANGED
@@ -13,27 +13,21 @@ begin
13
13
  gem.add_dependency 'actionmailer', '>= 1.3.6'
14
14
  gem.add_development_dependency 'rspec', '>= 1.2.9'
15
15
 
16
+ gem.files.exclude 'vendor/ginger'
16
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
18
  end
18
19
  rescue LoadError
19
20
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
20
21
  end
21
22
 
22
- require 'spec/rake/spectask'
23
- Spec::Rake::SpecTask.new(:spec) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
26
- end
27
-
28
- Spec::Rake::SpecTask.new(:rcov) do |spec|
29
- spec.libs << 'lib' << 'spec'
30
- spec.pattern = 'spec/**/*_spec.rb'
31
- spec.rcov = true
23
+ require "rspec/core/rake_task"
24
+ RSpec::Core::RakeTask.new(:spec) do |t|
25
+ #t.rspec_opts = %w[--format documentation]
32
26
  end
33
27
 
34
28
  task :spec => :check_dependencies if defined?(Jeweler)
35
29
 
36
- task :default => :spec
30
+ task :default => :ginger
37
31
 
38
32
  require 'rake/rdoctask'
39
33
  Rake::RDocTask.new do |rdoc|
@@ -51,3 +45,10 @@ Rake::RDocTask.new do |rdoc|
51
45
  rdoc.rdoc_files.include('lib/**/*.rb')
52
46
  end
53
47
 
48
+ desc 'Run ginger tests'
49
+ task :ginger do
50
+ $LOAD_PATH << File.join(*%w[vendor ginger lib])
51
+ ARGV.clear
52
+ ARGV << 'spec'
53
+ load File.join(*%w[vendor ginger bin ginger])
54
+ end
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :build:
2
3
  :major: 0
3
4
  :minor: 3
4
- :patch: 0
5
- :build:
5
+ :patch: 1
@@ -0,0 +1 @@
1
+ Autotest.add_discovery { 'rspec2' }
@@ -13,22 +13,31 @@ Ginger.configure do |config|
13
13
  config.aliases["action_pack"] = "actionpack"
14
14
  config.aliases["active_support"] = "activesupport"
15
15
 
16
- rails3 = create_scenario('3.0.0.beta')
17
- rails3['mail'] = '2.1.3'
18
- config.scenarios << rails3
16
+ # Rails 3 doesn't work on Ruby 1.8.6 or 1.9.1 so skip it.
17
+ if RUBY_VERSION == '1.8.7'
18
+ rails3 = create_scenario('3.0.0')
19
+ rails3['mail'] = '2.2.7'
20
+ config.scenarios << rails3
21
+ end
19
22
 
20
- %w(
21
- 2.3.5 2.3.4 2.3.3 2.3.2
22
- 2.2.3 2.2.2
23
- 2.1.2 2.1.1 2.1.0
24
- 2.0.5 2.0.4 2.0.2 2.0.1 2.0.0
25
- ).each do |version|
23
+ %w( 2.3.9 2.3.8 2.3.5 2.3.4 2.3.3 2.3.2 ).each do |version|
26
24
  config.scenarios << create_scenario(version)
27
25
  end
28
26
 
29
- rails126 = Ginger::Scenario.new("Rails 1.2.6")
30
- rails126[/^action_?mailer$/] = '1.3.6'
31
- rails126[/^action_?pack$/] = '1.13.6'
32
- rails126[/^active_?support$/] = '1.4.4'
33
- config.scenarios << rails126
34
- end
27
+ # Rails 2.3 was the first version that ran on ruby 1.9, so don't bother testing older versions.
28
+ if RUBY_VERSION =~ /^1\.8/
29
+ %w(
30
+ 2.2.3 2.2.2
31
+ 2.1.2 2.1.1 2.1.0
32
+ 2.0.5 2.0.4 2.0.2 2.0.1 2.0.0
33
+ ).each do |version|
34
+ config.scenarios << create_scenario(version)
35
+ end
36
+
37
+ rails126 = Ginger::Scenario.new("Rails 1.2.6")
38
+ rails126[/^action_?mailer$/] = '1.3.6'
39
+ rails126[/^action_?pack$/] = '1.13.6'
40
+ rails126[/^active_?support$/] = '1.4.4'
41
+ config.scenarios << rails126
42
+ end
43
+ end
@@ -1,4 +1,3 @@
1
- require 'active_support'
2
1
  require 'action_mailer'
3
2
  require 'action_mailer/version'
4
3
 
@@ -114,9 +114,10 @@ The original recipients were:
114
114
  end
115
115
  else
116
116
  def add_postscript(part, postscript)
117
+ postscript = postscript.html_safe if postscript.respond_to?(:html_safe)
117
118
  part.body = part.body.to_s + postscript
118
119
  end
119
120
  end
120
121
  end
121
122
  end
122
- end
123
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mail_safe}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Myron Marston"]
12
- s.date = %q{2010-02-24}
12
+ s.date = %q{2010-10-14}
13
13
  s.email = %q{myron.marston@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  "README.rdoc",
23
23
  "Rakefile",
24
24
  "VERSION.yml",
25
+ "autotest/discover.rb",
25
26
  "ginger_scenarios.rb",
26
27
  "lib/mail_safe.rb",
27
28
  "lib/mail_safe/address_replacer.rb",
@@ -29,29 +30,28 @@ Gem::Specification.new do |s|
29
30
  "lib/mail_safe/rails2_hook.rb",
30
31
  "lib/mail_safe/rails3_hook.rb",
31
32
  "mail_safe.gemspec",
32
- "spec/spec/config_spec.rb",
33
- "spec/spec/mailer_spec.rb",
34
- "spec/spec/mailers/test_mailer.rb",
35
- "spec/spec/spec.opts",
36
- "spec/spec/spec_helper.rb"
33
+ "spec/config_spec.rb",
34
+ "spec/mailer_spec.rb",
35
+ "spec/mailers/test_mailer.rb",
36
+ "spec/spec_helper.rb"
37
37
  ]
38
38
  s.homepage = %q{http://github.com/myronmarston/mail_safe}
39
39
  s.rdoc_options = ["--charset=UTF-8"]
40
40
  s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.6}
41
+ s.rubygems_version = %q{1.3.7}
42
42
  s.summary = %q{Keep your ActionMailer emails from escaping into the wild during development.}
43
43
  s.test_files = [
44
- "spec/spec/config_spec.rb",
45
- "spec/spec/mailer_spec.rb",
46
- "spec/spec/mailers/test_mailer.rb",
47
- "spec/spec/spec_helper.rb"
44
+ "spec/config_spec.rb",
45
+ "spec/mailer_spec.rb",
46
+ "spec/mailers/test_mailer.rb",
47
+ "spec/spec_helper.rb"
48
48
  ]
49
49
 
50
50
  if s.respond_to? :specification_version then
51
51
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
52
  s.specification_version = 3
53
53
 
54
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
55
  s.add_runtime_dependency(%q<actionmailer>, [">= 1.3.6"])
56
56
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
57
57
  else
@@ -12,9 +12,9 @@ describe MailSafe do
12
12
  end
13
13
  end
14
14
 
15
- def have_addresses(*addresses)
16
- simple_matcher("have addresses #{addresses.inspect}") do |array|
17
- array.to_a.sort == addresses
15
+ RSpec::Matchers.define :have_addresses do |*expected|
16
+ match do |actual|
17
+ actual.to_a.sort == expected
18
18
  end
19
19
  end
20
20
 
@@ -93,15 +93,15 @@ describe MailSafe do
93
93
  end
94
94
 
95
95
  def part(type)
96
- @email.parts.detect { |p| p.content_type == type }.body.to_s
96
+ @email.parts.detect { |p| p.content_type =~ type }.body.to_s
97
97
  end
98
98
 
99
99
  it 'adds a text post script to the body of the text part' do
100
- part('text/plain').should =~ TEXT_POSTSCRIPT_PHRASE
100
+ part(/text\/plain/).should =~ TEXT_POSTSCRIPT_PHRASE
101
101
  end
102
102
 
103
103
  it 'adds an html post script to the body of the html part' do
104
- part('text/html').should =~ HTML_POSTSCRIPT_PHRASE
104
+ part(/text\/html/).should =~ HTML_POSTSCRIPT_PHRASE
105
105
  end
106
106
  end
107
107
  end
@@ -1,13 +1,7 @@
1
- if ActionMailer::VERSION::MAJOR == 3
2
- require 'action_dispatch/http/mime_type' # needs to be required to avoid an error: uninitialized constant AbstractController::Collector::Mime
3
- end
4
-
5
1
  class TestMailer < ActionMailer::Base
6
2
  # template root must be set for multipart emails, or ActionMailer will throw an exception.
7
- if respond_to?(:view_paths)
8
- view_paths.unshift File.dirname(__FILE__)
9
- else
10
- template_root File.dirname(__FILE__)
3
+ if ActionMailer::VERSION::MAJOR == 2
4
+ self.template_root = File.dirname(__FILE__)
11
5
  end
12
6
 
13
7
  def plain_text_message(options)
@@ -23,6 +17,8 @@ class TestMailer < ActionMailer::Base
23
17
  subject "Html Message Test"
24
18
  body "<p>Here is the message body.</p>"
25
19
  content_type 'text/html'
20
+
21
+ body(body.html_safe) if body.respond_to?(:html_safe)
26
22
  end
27
23
 
28
24
  def multipart_message(options)
@@ -33,7 +29,10 @@ class TestMailer < ActionMailer::Base
33
29
  content_type 'multipart/alternative'
34
30
 
35
31
  part :content_type => 'text/plain', :body => "Here is the message body."
36
- part :content_type => 'text/html', :body => "<p>Here is the message body.</p>"
32
+
33
+ html_body = "<p>Here is the message body.</p>"
34
+ html_body = html_body.html_safe if html_body.respond_to?(:html_safe)
35
+ part :content_type => 'text/html', :body => html_body
37
36
  end
38
37
 
39
38
  protected
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+
3
+ $LOAD_PATH << File.join(File.dirname(__FILE__), *%w[.. vendor ginger lib])
4
+ require 'ginger'
5
+ require 'mail_safe'
6
+ require 'mailers/test_mailer'
7
+
8
+ ActionMailer::Base.delivery_method = :test
9
+
10
+ require 'rspec'
11
+ RSpec.configure do |config|
12
+ config.color_enabled = true
13
+ config.debug = true
14
+ config.filter_run :focus => true
15
+ config.run_all_when_everything_filtered = true
16
+ end
17
+
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_safe
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 0
9
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Myron Marston
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-02-24 00:00:00 -08:00
18
+ date: 2010-10-14 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: actionmailer
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 23
27
30
  segments:
28
31
  - 1
29
32
  - 3
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: rspec
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 13
41
46
  segments:
42
47
  - 1
43
48
  - 2
@@ -61,6 +66,7 @@ files:
61
66
  - README.rdoc
62
67
  - Rakefile
63
68
  - VERSION.yml
69
+ - autotest/discover.rb
64
70
  - ginger_scenarios.rb
65
71
  - lib/mail_safe.rb
66
72
  - lib/mail_safe/address_replacer.rb
@@ -68,11 +74,10 @@ files:
68
74
  - lib/mail_safe/rails2_hook.rb
69
75
  - lib/mail_safe/rails3_hook.rb
70
76
  - mail_safe.gemspec
71
- - spec/spec/config_spec.rb
72
- - spec/spec/mailer_spec.rb
73
- - spec/spec/mailers/test_mailer.rb
74
- - spec/spec/spec.opts
75
- - spec/spec/spec_helper.rb
77
+ - spec/config_spec.rb
78
+ - spec/mailer_spec.rb
79
+ - spec/mailers/test_mailer.rb
80
+ - spec/spec_helper.rb
76
81
  has_rdoc: true
77
82
  homepage: http://github.com/myronmarston/mail_safe
78
83
  licenses: []
@@ -83,28 +88,32 @@ rdoc_options:
83
88
  require_paths:
84
89
  - lib
85
90
  required_ruby_version: !ruby/object:Gem::Requirement
91
+ none: false
86
92
  requirements:
87
93
  - - ">="
88
94
  - !ruby/object:Gem::Version
95
+ hash: 3
89
96
  segments:
90
97
  - 0
91
98
  version: "0"
92
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
93
101
  requirements:
94
102
  - - ">="
95
103
  - !ruby/object:Gem::Version
104
+ hash: 3
96
105
  segments:
97
106
  - 0
98
107
  version: "0"
99
108
  requirements: []
100
109
 
101
110
  rubyforge_project:
102
- rubygems_version: 1.3.6
111
+ rubygems_version: 1.3.7
103
112
  signing_key:
104
113
  specification_version: 3
105
114
  summary: Keep your ActionMailer emails from escaping into the wild during development.
106
115
  test_files:
107
- - spec/spec/config_spec.rb
108
- - spec/spec/mailer_spec.rb
109
- - spec/spec/mailers/test_mailer.rb
110
- - spec/spec/spec_helper.rb
116
+ - spec/config_spec.rb
117
+ - spec/mailer_spec.rb
118
+ - spec/mailers/test_mailer.rb
119
+ - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- --color
@@ -1,21 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'spec'
4
- require 'spec/autorun'
5
- require 'rubygems'
6
- require 'ginger'
7
- require 'mail_safe'
8
- require 'mailers/test_mailer'
9
-
10
- begin
11
- require 'ruby-debug'
12
- Debugger.start
13
- Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
14
- rescue LoadError
15
- # ruby-debug wasn't available so neither can the debugging be
16
- end
17
-
18
- ActionMailer::Base.delivery_method = :test
19
-
20
- Spec::Runner.configure do |config|
21
- end