Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test against actionmailer 3.0, 3.1, 3.2, 4.0 #23

Merged
merged 3 commits into from Mar 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Expand Up @@ -4,7 +4,16 @@ rvm:
- ree
- jruby-18mode
gemfile:
- gemfiles/Gemfile-rails.3.0.x
- gemfiles/Gemfile-rails.3.1.x
- gemfiles/Gemfile-rails.3.2.x
- Gemfile
matrix:
exclude:
- rvm: ree
gemfile: Gemfile
- rvm: jruby-18mode
gemfile: Gemfile
notifications:
recipients:
- jose.valim@plataformatec.com.br
Expand Down
5 changes: 4 additions & 1 deletion Gemfile
@@ -1,6 +1,9 @@
source :rubygems
source 'https://rubygems.org'

gemspec

gem 'rake'
gem 'rdoc'

gem 'actionmailer', '~> 4.0.0.beta1'
gem 'activemodel', '~> 4.0.0.beta1'
77 changes: 37 additions & 40 deletions Gemfile.lock
@@ -1,66 +1,63 @@
PATH
remote: .
specs:
mail_form (1.3.0)
actionmailer (~> 3.0)
mail_form (1.4.0)
actionmailer (>= 3.0)
activemodel (>= 3.0)

GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
actionmailer (3.2.9)
actionpack (= 3.2.9)
mail (~> 2.4.4)
actionpack (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
builder (~> 3.0.0)
actionmailer (4.0.0.beta1)
actionpack (= 4.0.0.beta1)
mail (~> 2.5.3)
actionpack (4.0.0.beta1)
activesupport (= 4.0.0.beta1)
builder (~> 3.1.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.9)
activesupport (= 3.2.9)
builder (~> 3.0.0)
activesupport (3.2.9)
i18n (~> 0.6)
multi_json (~> 1.0)
builder (3.0.4)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.0.beta1)
activesupport (= 4.0.0.beta1)
builder (~> 3.1.0)
activesupport (4.0.0.beta1)
i18n (~> 0.6.2)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.33)
atomic (1.0.1)
builder (3.1.4)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
json (1.7.5)
mail (2.4.4)
i18n (0.6.4)
json (1.7.7)
mail (2.5.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.7)
mime-types (1.21)
minitest (4.7.0)
multi_json (1.7.2)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rake (10.0.2)
rdoc (3.12)
rake (10.0.3)
rdoc (4.0.0)
json (~> 1.4)
sprockets (2.2.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
tilt (1.3.3)
thread_safe (0.1.0)
atomic
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)

PLATFORMS
ruby

DEPENDENCIES
actionmailer (~> 4.0.0.beta1)
activemodel (~> 4.0.0.beta1)
mail_form!
rake
rdoc
9 changes: 9 additions & 0 deletions gemfiles/Gemfile-rails.3.0.x
@@ -0,0 +1,9 @@
source 'https://rubygems.org'

gem 'mail_form', :path => '..'

gem 'rake'
gem 'rdoc'

gem 'actionmailer', '~> 3.0.0'
gem 'activemodel', '~> 3.0.0'
9 changes: 9 additions & 0 deletions gemfiles/Gemfile-rails.3.1.x
@@ -0,0 +1,9 @@
source 'https://rubygems.org'

gem 'mail_form', :path => '..'

gem 'rake'
gem 'rdoc'

gem 'actionmailer', '~> 3.1.0'
gem 'activemodel', '~> 3.1.0'
9 changes: 9 additions & 0 deletions gemfiles/Gemfile-rails.3.2.x
@@ -0,0 +1,9 @@
source 'https://rubygems.org'

gem 'mail_form', :path => '..'

gem 'rake'
gem 'rdoc'

gem 'actionmailer', '~> 3.2.0'
gem 'activemodel', '~> 3.2.0'
17 changes: 16 additions & 1 deletion lib/mail_form/notifier.rb
@@ -1,5 +1,20 @@
module MailForm
class Notifier < ActionMailer::Base
# since ActionMailer 3.0 has own simple_format method
# but we need one from the ActionPack
# https://github.com/rails/rails/commit/fb34f8577c47d958ca32b7ab585c1904e1a776b1
helper do
def simple_format(text, html_options={}, options={})
@text_helper ||= Class.new do
include ActionView::Helpers::TextHelper
include ActionView::Helpers::TagHelper
include ActionView::Helpers::SanitizeHelper
end.new

@text_helper.simple_format(text, html_options, options)
end
end

self.mailer_name = "mail_form"
append_view_path File.expand_path('../views', __FILE__)

Expand All @@ -22,4 +37,4 @@ def contact(resource)
mail(headers)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/mail_form/shim.rb
Expand Up @@ -46,7 +46,7 @@ def id
# Create just check validity, and if so, trigger callbacks.
def deliver
if valid?
_run_deliver_callbacks { true }
run_callbacks :deliver
else
false
end
Expand Down
5 changes: 3 additions & 2 deletions lib/mail_form/views/mail_form/contact.erb
Expand Up @@ -22,8 +22,9 @@
value = @resource.request.send(attribute)

value = if value.is_a?(Hash) && !value.empty?
list = value.to_a.map{ |k,v| content_tag(:li, h("#{k}: #{v.inspect}")) }.join("\n")
content_tag(:ul, raw(list), :style => "list-style:none;")
content_tag(:ul, :style => "list-style:none;") do
value.to_a.map{ |k,v| content_tag(:li, h("#{k}: #{v.inspect}")) }.reduce{ |list, li| list << li << '\n'.html_safe }
end
elsif value.is_a?(String)
value
else
Expand Down
3 changes: 2 additions & 1 deletion mail_form.gemspec
Expand Up @@ -18,5 +18,6 @@ Gem::Specification.new do |s|

s.rubyforge_project = "mail_form"

s.add_dependency('actionmailer', '~> 3.0')
s.add_dependency('actionmailer', '>= 3.0')
s.add_dependency('activemodel', '>= 3.0')
end