rakismet 1.5.3 → 1.5.4

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: cf228545419704714621f2ae6e6e1cc37e702eb6
4
- data.tar.gz: 6f39f292c5ac67f57ddc6f499237ef7b339f1523
3
+ metadata.gz: c8bc157e4813efa686db0b46304c70f757c60dd7
4
+ data.tar.gz: dd04179466c530a7c3dc2a633ee27e95f842ee8d
5
5
  SHA512:
6
- metadata.gz: 33a9d267a17332f49b7f0500841bd777bc741185c64ae37ba1f53d3e4f0229fb8eaa1a7606a1c8c76aa4704470ada00b5720e1117cf0bb6e82acc5dd28daafc3
7
- data.tar.gz: 1a5ec9899dbebca1877cffb018e81302bccc928eef49dfa9cd8e3e4f1df56111e9aafd4b22ac6241b5a838321e699364c662687703510dd0fc35836f54e4398a
6
+ metadata.gz: 7321aaccaa49a51f68218b9a851db5dd6ebfe69ffef9822c136e2f8092517515634bc4dac07f1d020e4a4f660eaca5826ecadfe14e4ad9a5fcc184dafb42beeb
7
+ data.tar.gz: d014957d99a0822a481e65aa35ef0f41672c6a731816d03aef5e2f387566558745dd95f109cd3507553970623f4c477a108d211446678c88e3803bd0b215bb36
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ = 1.5.4
2
+ * Don't prefix permalink param with comment_
1
3
  = 1.5.3
2
4
  * Use HTTPS to connect to Akismet [Christian Wesselhoeft]
3
5
  = 1.5.2
@@ -14,12 +14,11 @@ module Rakismet
14
14
  module ClassMethods
15
15
  def rakismet_attrs(args={})
16
16
  self.akismet_attrs ||= {}
17
- [:comment_type, :author, :author_url, :author_email, :content, :permalink].each do |field|
18
- # clunky, but throwing around +type+ will break your heart
19
- fieldname = field.to_s =~ %r(^comment_) ? field : "comment_#{field}".intern
17
+ [:author, :author_url, :author_email, :content].each do |field|
18
+ fieldname = "comment_#{field}".intern
20
19
  self.akismet_attrs[fieldname] = args.delete(field) || field
21
20
  end
22
- [:user_ip, :user_agent, :referrer, :user_role].each do |field|
21
+ [:comment_type, :user_ip, :user_agent, :referrer, :user_role, :permalink].each do |field|
23
22
  self.akismet_attrs[field] = args.delete(field) || field
24
23
  end
25
24
  args.each_pair do |f,v|
@@ -1,3 +1,3 @@
1
1
  module Rakismet
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "http://github.com/joshfrench/rakismet"
11
11
  s.summary = "Akismet and TypePad AntiSpam integration for Rails."
12
12
  s.description = "Rakismet is the easiest way to integrate Akismet or TypePad's AntiSpam into your Rails app."
13
- s.date = "2016-06-12"
13
+ s.date = "2017-07-14"
14
14
 
15
15
  s.rubyforge_project = "rakismet"
16
16
  s.add_development_dependency "rake"
@@ -12,9 +12,11 @@ end
12
12
 
13
13
  describe CustomAkismetModel do
14
14
  it "should override default mappings" do
15
- [:comment_type, :author, :author_url, :author_email, :content, :user_role, :permalink].each do |field|
16
- fieldname = field.to_s =~ %r(^comment_) ? field : "comment_#{field}".intern
17
- CustomAkismetModel.akismet_attrs[fieldname].should eql(MAPPED_PARAMS[field])
18
- end
15
+ CustomAkismetModel.akismet_attrs[:comment_type].should eql(:type2)
16
+ CustomAkismetModel.akismet_attrs[:comment_author].should eql(:author2)
17
+ CustomAkismetModel.akismet_attrs[:comment_content].should eql(:content2)
18
+ CustomAkismetModel.akismet_attrs[:comment_author_email].should eql(:author_email2)
19
+ CustomAkismetModel.akismet_attrs[:comment_author_url].should eql(:author_url2)
20
+ CustomAkismetModel.akismet_attrs[:permalink].should eql(:permalink2)
19
21
  end
20
22
  end
@@ -7,11 +7,13 @@ describe AkismetModel do
7
7
  comment_attrs.each_pair { |k,v| @model.stub(k).and_return(v) }
8
8
  end
9
9
 
10
- it "should have default mappings" do
11
- [:comment_type, :author, :author_email, :author_url, :content, :permalink].each do |field|
12
- fieldname = field.to_s =~ %r(^comment_) ? field : "comment_#{field}".intern
13
- AkismetModel.akismet_attrs[fieldname].should eql(field)
14
- end
10
+ it "should map internal params to Akismet params" do
11
+ AkismetModel::akismet_attrs[:comment_author].should eql(:author)
12
+ AkismetModel::akismet_attrs[:comment_author_email].should eql(:author_email)
13
+ AkismetModel::akismet_attrs[:comment_author_url].should eql(:author_url)
14
+ AkismetModel::akismet_attrs[:comment_content].should eql(:content)
15
+ AkismetModel::akismet_attrs[:comment_type].should eql(:comment_type)
16
+ AkismetModel::akismet_attrs[:permalink].should eql(:permalink)
15
17
  AkismetModel::akismet_attrs[:user_role].should eql(:user_role)
16
18
  end
17
19
 
@@ -39,17 +39,17 @@ describe Rakismet do
39
39
  describe ".validate_config" do
40
40
  it "should raise an error if key is not found" do
41
41
  Rakismet.key = ''
42
- lambda { Rakismet.send(:validate_config) }.should raise_error
42
+ lambda { Rakismet.send(:validate_config) }.should raise_error(Rakismet::Undefined)
43
43
  end
44
44
 
45
45
  it "should raise an error if url is not found" do
46
46
  Rakismet.url = ''
47
- lambda { Rakismet.send(:validate_config) }.should raise_error
47
+ lambda { Rakismet.send(:validate_config) }.should raise_error(Rakismet::Undefined)
48
48
  end
49
49
 
50
50
  it "should raise an error if host is not found" do
51
51
  Rakismet.host = ''
52
- lambda { Rakismet.send(:validate_config) }.should raise_error
52
+ lambda { Rakismet.send(:validate_config) }.should raise_error(Rakismet::Undefined)
53
53
  end
54
54
  end
55
55
 
@@ -40,4 +40,4 @@ def empty_request
40
40
  :user_agent => nil,
41
41
  :referrer => nil,
42
42
  :http_headers => nil)
43
- end
43
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakismet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh French
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-12 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project: rakismet
90
- rubygems_version: 2.5.1
90
+ rubygems_version: 2.6.11
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Akismet and TypePad AntiSpam integration for Rails.