mail_form 1.6.0 → 1.7.0

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: 1d303b19e76c996f383cdd3cca96a6d1f5ebbf99
4
- data.tar.gz: 37b37ccd2e0f7d3e534d9985dc79f04cfbc1d4d3
3
+ metadata.gz: b6518ae2061974f6752fb23da63807e6977b0f3c
4
+ data.tar.gz: 8ed10502f0cc6ba1a2fb546ff2032f88be2dec72
5
5
  SHA512:
6
- metadata.gz: cef061942f687c6d82678d7258d8360093efc67f8ff93dcd0721ffe788e3ee64f1f8817930b22ef8ab463e1292e96eecf0aab5b10d03d64109c333f9af9eda05
7
- data.tar.gz: aa04d2badd1f88698639de4ab99ccc7ce48d004a044662d29445a3341ee3aea0257a9c58f65affe72a9640b5ce274c8fe8e83bb2c6612ef85586db8cf20ec0b4
6
+ metadata.gz: f6e331507e760518207fbf072d43a6dbadde4d3bff14cc9eac32e314d54772a737023ff2e3dba6b9b73bef350b8da9484a55828db2b1c12e750d79167543ee3d
7
+ data.tar.gz: 4746bdd0ab9f965af5a220ad6fa962ab501269bbbccdafdf8a20e0e781a4719f78230aa5e32a96952aecd277367b03e9c9da086c42cf9d0dfd2132b88c9f30dc
@@ -15,7 +15,12 @@ module MailForm
15
15
  class_attribute :mail_appendable
16
16
  self.mail_appendable = []
17
17
 
18
- if respond_to?(:before_deliver) && respond_to?(:after_deliver)
18
+ # not_spam? simply returns false, but when used as a callback, we have to throw(:abort)
19
+ # to halt the callback chain, beginning with Rails 5.1.
20
+ if ActionPack.respond_to?(:version) && ActionPack.version >= Gem::Version.new('5.1')
21
+ before_deliver :check_not_spam
22
+ after_deliver :deliver!
23
+ elsif respond_to?(:before_deliver) && respond_to?(:after_deliver)
19
24
  before_deliver :not_spam?
20
25
  after_deliver :deliver!
21
26
  else # For ActiveRecord compatibility
@@ -146,6 +151,10 @@ module MailForm
146
151
  !spam?
147
152
  end
148
153
 
154
+ def check_not_spam
155
+ throw(:abort) if spam?
156
+ end
157
+
149
158
  # Deliver the resource without running any validation.
150
159
  def deliver!
151
160
  mailer = MailForm::Notifier.contact(self)
@@ -1,3 +1,3 @@
1
1
  module MailForm
2
- VERSION = "1.6.0".freeze
2
+ VERSION = "1.7.0".freeze
3
3
  end
@@ -7,9 +7,13 @@ class MailFormNotifierTest < ActiveSupport::TestCase
7
7
  def setup
8
8
  @form = ContactForm.new(:name => 'José', :email => 'my.email@my.domain.com', :message => 'Cool')
9
9
 
10
- ActionController::TestRequest.respond_to?(:create) ?
11
- @request = ActionController::TestRequest.create :
12
- @request = ActionController::TestRequest.new
10
+ @request = if ActionPack.respond_to?(:version) && ActionPack.version >= Gem::Version.new('5.1')
11
+ ActionController::TestRequest.create(Class.new) # Rails 5.1
12
+ elsif ActionPack.respond_to?(:version) && ActionPack.version >= Gem::Version.new('5.0')
13
+ ActionController::TestRequest.create # Rails 5
14
+ else
15
+ ActionController::TestRequest.new
16
+ end
13
17
  @valid_attributes = { :name => 'José', :email => 'my.email@my.domain.com', :message => "Cool\nno?" }
14
18
  @advanced = AdvancedForm.new(@valid_attributes)
15
19
  @advanced.request = @request
@@ -9,7 +9,7 @@ class MailFormBaseTest < ActiveSupport::TestCase
9
9
  end
10
10
 
11
11
  def test_id_is_nil
12
- assert_equal nil, ContactForm.new.id
12
+ assert_nil ContactForm.new.id
13
13
  end
14
14
 
15
15
  def test_is_always_a_new_record
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-31 00:00:00.000000000 Z
12
+ date: 2017-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionmailer
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '3.2'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '5.1'
23
+ version: '5.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '3.2'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.1'
33
+ version: '5.2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activemodel
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '3.2'
41
41
  - - "<"
42
42
  - !ruby/object:Gem::Version
43
- version: '5.1'
43
+ version: '5.2'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: '3.2'
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: '5.1'
53
+ version: '5.2'
54
54
  description: Send e-mail straight from forms in Rails with I18n, validations, attachments
55
55
  and request information.
56
56
  email: contact@plataformatec.com.br
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project: mail_form
97
- rubygems_version: 2.5.1
97
+ rubygems_version: 2.6.10
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Send e-mail straight from forms in Rails with I18n, validations, attachments
@@ -105,4 +105,3 @@ test_files:
105
105
  - test/test_file.txt
106
106
  - test/test_helper.rb
107
107
  - test/views/mail_form/custom_template.erb
108
- has_rdoc: