spf-query 0.1.0 → 0.1.1

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: 2ff5617efe1d25eb977c95ea135429a293fec88e
4
- data.tar.gz: ac75eeee0b297184a1501bc87d74e849cbb5900d
3
+ metadata.gz: ad212d3a18fdf143d0a478c9b703a51fd790b704
4
+ data.tar.gz: 85e5eaf89a001162b200707971c1aeeccf59fac8
5
5
  SHA512:
6
- metadata.gz: b6c50e12e4bf16b1386acdf25763e9edfa2e1fc5eb053853f8d3e233152bbec8936eb7f69da239aa2cdc142e7de4893aaa4f123d03c47a18ca80000bdd96ede2
7
- data.tar.gz: fe9187d1722b7c20f8d8ec03e1e5244c7ed9762e2b96d056e19f582531071a5e2811638a693909df893eaccf0e339c5b9eb10e00fcc89428953dd6964f800451
6
+ metadata.gz: ebdda6c3f7346574531cdcd5c2739e5424077fe768712298cc239a6c7f46e68fc799b2d0921d63b528ad78102a5424e2f03312818d4c9586472a0e8d569849b3
7
+ data.tar.gz: e3a139ead34ca81521bd4ff91696d5152db75b9380d364f39acdfc9d3a98f047bb1344933d372c2dddf083732c131239d6564e6964a23e463f73e836c3930bd1
data/.travis.yml CHANGED
@@ -3,9 +3,8 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0
5
5
  - 2.1
6
- - ruby-head
7
- - jruby-19mode
8
- - jruby-head
6
+ - 2.2
7
+ - jruby
9
8
  - rbx-2
10
9
  matrix:
11
10
  allow_failures:
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.1.1 / 2015-07-06
2
+
3
+ * Raise {SPF::Query::SenderIDFound} from {SPF::Query::Record.parse} if
4
+ [Sender ID](http://www.openspf.org/SPF_vs_Sender_ID) is detected.
5
+
1
6
  ### 0.1.0 / 2015-07-01
2
7
 
3
8
  * Initial release:
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gemspec
4
4
 
5
5
  group :development do
6
6
  gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
7
8
  gem 'rspec', '~> 3.0'
8
9
 
9
10
  gem 'kramdown'
data/Rakefile CHANGED
@@ -10,7 +10,8 @@ rescue LoadError => e
10
10
  end
11
11
 
12
12
  require 'rake'
13
- require 'bundler/gem_tasks'
13
+ require 'rubygems/tasks'
14
+ Gem::Tasks.new
14
15
 
15
16
  require 'rspec/core/rake_task'
16
17
  RSpec::Core::RakeTask.new
@@ -4,5 +4,8 @@ module SPF
4
4
  module Query
5
5
  class InvalidRecord < Parslet::ParseFailed
6
6
  end
7
+
8
+ class SenderIDFound < InvalidRecord
9
+ end
7
10
  end
8
11
  end
@@ -272,6 +272,8 @@ module SPF
272
272
  # @return [Record]
273
273
  # The parsed SPF record.
274
274
  #
275
+ # @raise [Parslet::ParseError]
276
+ #
275
277
  def self.parse(spf)
276
278
  Transform.new.apply(new.parse(spf))
277
279
  end
@@ -134,14 +134,22 @@ module SPF
134
134
  # @raise [InvalidRecord]
135
135
  # The SPF record could not be parsed.
136
136
  #
137
+ # @raise [SenderIDFound]
138
+ #
137
139
  # @see Parser.parse
138
140
  #
139
141
  # @api public
140
142
  #
141
143
  def self.parse(spf)
142
- Parser.parse(spf)
143
- rescue Parslet::ParseFailed => error
144
- raise(InvalidRecord.new(error.message,error.cause))
144
+ if spf.include?('spf2.0')
145
+ raise(SenderIDFound,"Sender ID was found in place of SPF")
146
+ end
147
+
148
+ begin
149
+ Parser.parse(spf)
150
+ rescue Parslet::ParseFailed => error
151
+ raise(InvalidRecord.new(error.message,error.cause))
152
+ end
145
153
  end
146
154
 
147
155
  #
@@ -1,5 +1,5 @@
1
1
  module SPF
2
2
  module Query
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
data/spec/record_spec.rb CHANGED
@@ -173,6 +173,16 @@ describe SPF::Query::Record do
173
173
  }.to raise_error(InvalidRecord)
174
174
  end
175
175
  end
176
+
177
+ context "when given a SenderID record" do
178
+ let(:sender_id) { "spf2.0/mfrom,pra or spf2.0/pra,mfrom" }
179
+
180
+ it "should raise a SenderIDFound exception" do
181
+ expect {
182
+ described_class.parse(sender_id)
183
+ }.to raise_error(SenderIDFound)
184
+ end
185
+ end
176
186
  end
177
187
 
178
188
  describe ".query" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spf-query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nicktitle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -118,4 +118,3 @@ test_files:
118
118
  - spec/query_spec.rb
119
119
  - spec/record_spec.rb
120
120
  - spec/spec_helper.rb
121
- has_rdoc: