dns-zonefile 1.0.7 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/Dockerfile +10 -0
- data/Rakefile +2 -21
- data/dns-zonefile.gemspec +1 -1
- data/docker-compose.yml +4 -0
- data/lib/dns/zonefile.rb +4 -3
- data/{doc → lib/dns}/zonefile.treetop +0 -0
- data/lib/dns/zonefile/version.rb +1 -1
- data/spec/dns/zonefile_spec.rb +128 -130
- metadata +9 -8
- data/lib/dns/zonefile/parser.rb +0 -4639
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2827522219ce8faf8c79547c65317965d5a628eb
|
4
|
+
data.tar.gz: 9cb7a17d1ee296c80c68e682ee1b4d3a2384232e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 786c0b7a22598d0f27826ef8c3e7ea8e851e990fedd981f3d88dd112c98a8b483f1c7fd665eddf51a83f60a23360350a81a714699a0a5225c1f2a4482c037e8d
|
7
|
+
data.tar.gz: 654452ea27aa6752a3d2a275e93634dee0283c3e3011a782254e83fe73e7fbaa9e88433bc2b0947d3200475aa6c4aca8c05faff34c68c928c8f45ffae3d2c5c1
|
data/.travis.yml
CHANGED
data/Dockerfile
ADDED
data/Rakefile
CHANGED
@@ -4,27 +4,8 @@ require 'rake'
|
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
|
7
|
-
task :default => [ :
|
7
|
+
task :default => [ :spec ]
|
8
8
|
|
9
|
-
|
10
|
-
task :generate_grammar do
|
11
|
-
parser_file = 'lib/dns/zonefile/parser.rb'
|
12
|
-
File.unlink(parser_file) if File.exists?(parser_file)
|
13
|
-
puts %x[tt doc/zonefile -o #{parser_file}]
|
14
|
-
source = "require 'treetop'\n\n"
|
15
|
-
source += "module DNS\n"
|
16
|
-
source += " module Zonefile\n"
|
17
|
-
parser_source = File.open(parser_file, 'r').read
|
18
|
-
parser_source.gsub!(/(\s+)Zonefile$/, '\1ZonefileGrammar # :nodoc:')
|
19
|
-
parser_source.gsub!(/(\s+)ZonefileParser/, '\1Parser')
|
20
|
-
source += parser_source.split(/\n/).map { |l| " #{l}".rstrip }.join("\n")
|
21
|
-
source += "\n end"
|
22
|
-
source += "\nend"
|
23
|
-
File.open(parser_file, 'w') do |f|
|
24
|
-
f.write(source)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
task :build => [ :generate_grammar, :spec ] do
|
9
|
+
task :build do
|
29
10
|
puts %x[gem build dns-zonefile.gemspec]
|
30
11
|
end
|
data/dns-zonefile.gemspec
CHANGED
@@ -24,7 +24,7 @@ some canonical form.}
|
|
24
24
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
25
|
s.require_paths = ["lib"]
|
26
26
|
|
27
|
-
s.add_development_dependency "rspec"
|
27
|
+
s.add_development_dependency "rspec"
|
28
28
|
s.add_development_dependency "rake"
|
29
29
|
s.add_runtime_dependency "treetop"
|
30
30
|
s.add_runtime_dependency "polyglot"
|
data/docker-compose.yml
ADDED
data/lib/dns/zonefile.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
require 'dns/zonefile/
|
2
|
-
require '
|
1
|
+
require 'dns/zonefile/version'
|
2
|
+
require 'treetop'
|
3
|
+
Treetop.load 'lib/dns/zonefile'
|
3
4
|
|
4
5
|
module DNS
|
5
6
|
module Zonefile
|
6
7
|
class << self
|
7
8
|
def parse(zone_string)
|
8
|
-
parser =
|
9
|
+
parser = ZonefileParser.new
|
9
10
|
if result = parser.parse(zone_string)
|
10
11
|
result
|
11
12
|
else
|
File without changes
|
data/lib/dns/zonefile/version.rb
CHANGED
data/spec/dns/zonefile_spec.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'dns/zonefile'
|
3
3
|
|
4
|
-
describe "DNS::Zonefile" do
|
4
|
+
RSpec.describe "DNS::Zonefile" do
|
5
5
|
it "should be versioned" do
|
6
|
-
|
7
|
-
DNS::Zonefile.const_get(:VERSION)
|
8
|
-
}.should_not raise_error
|
6
|
+
expect { DNS::Zonefile.const_get(:VERSION) }.to_not raise_error
|
9
7
|
end
|
10
8
|
|
11
9
|
it "should provide a way of parsing a string" do
|
12
|
-
DNS::Zonefile.
|
10
|
+
expect(DNS::Zonefile).to respond_to(:parse)
|
13
11
|
end
|
14
12
|
|
15
13
|
describe "parsing a zonefile string" do
|
@@ -112,279 +110,279 @@ ZONE
|
|
112
110
|
|
113
111
|
it "should set the origin correctly" do
|
114
112
|
zone = DNS::Zonefile.parse(@zonefile)
|
115
|
-
zone.origin.
|
113
|
+
expect(zone.origin).to eq('@')
|
116
114
|
end
|
117
115
|
|
118
116
|
it "should interpret the origin correctly" do
|
119
117
|
zone = DNS::Zonefile.load(@zonefile)
|
120
|
-
zone.soa.origin.
|
118
|
+
expect(zone.soa.origin).to eq('example.com.')
|
121
119
|
end
|
122
120
|
|
123
121
|
it "should set the zone variables correctly" do
|
124
122
|
zone = DNS::Zonefile.parse(@zonefile)
|
125
|
-
zone.variables['TTL'].
|
126
|
-
zone.variables['ORIGIN'].
|
123
|
+
expect(zone.variables['TTL']).to eq('86400')
|
124
|
+
expect(zone.variables['ORIGIN']).to eq('example.com.')
|
127
125
|
end
|
128
126
|
|
129
127
|
it "should interpret the SOA correctly" do
|
130
128
|
zone = DNS::Zonefile.load(@zonefile)
|
131
129
|
soa = zone.soa
|
132
|
-
soa.klass.
|
133
|
-
soa.ttl.
|
134
|
-
soa.nameserver.
|
135
|
-
soa.responsible_party.
|
136
|
-
soa.serial.
|
137
|
-
soa.refresh_time.
|
138
|
-
soa.retry_time.
|
139
|
-
soa.expiry_time.
|
140
|
-
soa.nxttl.
|
130
|
+
expect(soa.klass).to eq('IN')
|
131
|
+
expect(soa.ttl).to eq(86400)
|
132
|
+
expect(soa.nameserver).to eq('ns.example.com.')
|
133
|
+
expect(soa.responsible_party).to eq('hostmaster\.awesome.example.com.')
|
134
|
+
expect(soa.serial).to eq(2007120710)
|
135
|
+
expect(soa.refresh_time).to eq(86400)
|
136
|
+
expect(soa.retry_time).to eq(86400)
|
137
|
+
expect(soa.expiry_time).to eq(2419200)
|
138
|
+
expect(soa.nxttl).to eq(3600)
|
141
139
|
end
|
142
140
|
|
143
141
|
it "should build the correct number of resource records" do
|
144
142
|
zone = DNS::Zonefile.parse(@zonefile)
|
145
|
-
zone.rr.size.
|
143
|
+
expect(zone.rr.size).to eq(49)
|
146
144
|
end
|
147
145
|
|
148
146
|
it "should build the correct NS records" do
|
149
147
|
zone = DNS::Zonefile.load(@zonefile)
|
150
148
|
ns_records = zone.records_of DNS::Zonefile::NS
|
151
|
-
ns_records.size.
|
149
|
+
expect(ns_records.size).to eq(2)
|
152
150
|
|
153
|
-
ns_records.detect { |ns|
|
151
|
+
expect(ns_records.detect { |ns|
|
154
152
|
ns.host == "example.com." && ns.nameserver == "ns.example.com."
|
155
|
-
}.
|
153
|
+
}).to_not be_nil
|
156
154
|
|
157
|
-
ns_records.detect { |ns|
|
155
|
+
expect(ns_records.detect { |ns|
|
158
156
|
ns.host == "example.com." && ns.nameserver == "ns.somewhere.com." && ns.ttl == 86400
|
159
|
-
}.
|
157
|
+
}).to_not be_nil
|
160
158
|
end
|
161
159
|
|
162
160
|
it "should build the correct A records" do
|
163
161
|
zone = DNS::Zonefile.load(@zonefile)
|
164
162
|
a_records = zone.records_of DNS::Zonefile::A
|
165
|
-
a_records.size.
|
163
|
+
expect(a_records.size).to eq(13)
|
166
164
|
|
167
|
-
a_records.detect { |a|
|
165
|
+
expect(a_records.detect { |a|
|
168
166
|
a.host == "example.com." && a.address == "10.0.0.1"
|
169
|
-
}.
|
167
|
+
}).to_not be_nil
|
170
168
|
|
171
|
-
a_records.detect { |a|
|
169
|
+
expect(a_records.detect { |a|
|
172
170
|
a.host == "example.com." && a.address == "10.0.0.11"
|
173
|
-
}.
|
171
|
+
}).to_not be_nil
|
174
172
|
|
175
|
-
a_records.detect { |a|
|
173
|
+
expect(a_records.detect { |a|
|
176
174
|
a.host == "example.com." && a.address == "10.0.0.12"
|
177
|
-
}.
|
175
|
+
}).to_not be_nil
|
178
176
|
|
179
|
-
a_records.detect { |a|
|
177
|
+
expect(a_records.detect { |a|
|
180
178
|
a.host == "ns.example.com." && a.address == "10.0.0.2" && a.ttl == 86400
|
181
|
-
}.
|
179
|
+
}).to_not be_nil
|
182
180
|
|
183
|
-
a_records.detect { |a|
|
181
|
+
expect(a_records.detect { |a|
|
184
182
|
a.host == "ns.example.com." && a.address == "10.0.0.21" && a.ttl == 60
|
185
|
-
}.
|
183
|
+
}).to_not be_nil
|
186
184
|
|
187
|
-
a_records.detect { |a|
|
185
|
+
expect(a_records.detect { |a|
|
188
186
|
a.host == "*.example.com." && a.address == "10.0.0.100"
|
189
|
-
}.
|
187
|
+
}).to_not be_nil
|
190
188
|
|
191
|
-
a_records.detect { |a|
|
189
|
+
expect(a_records.detect { |a|
|
192
190
|
a.host == "*.sub.example.com." && a.address == "10.0.0.101"
|
193
|
-
}.
|
191
|
+
}).to_not be_nil
|
194
192
|
|
195
|
-
a_records.detect { |a|
|
193
|
+
expect(a_records.detect { |a|
|
196
194
|
a.host == "with-class.example.com." && a.address == "10.0.0.3" && a.ttl == 86400
|
197
|
-
}.
|
195
|
+
}).to_not be_nil
|
198
196
|
|
199
|
-
a_records.detect { |a|
|
197
|
+
expect(a_records.detect { |a|
|
200
198
|
a.host == "with-ttl.example.com." && a.address == "10.0.0.5" && a.ttl == 60
|
201
|
-
}.
|
199
|
+
}).to_not be_nil
|
202
200
|
|
203
|
-
a_records.detect { |a|
|
201
|
+
expect(a_records.detect { |a|
|
204
202
|
a.host == "with-age.example.com." && a.address == "10.0.0.7" && a.ttl == 60
|
205
|
-
}.
|
203
|
+
}).to_not be_nil
|
206
204
|
|
207
|
-
a_records.detect { |a|
|
205
|
+
expect(a_records.detect { |a|
|
208
206
|
a.host == "ttl-class.example.com." && a.address == "10.0.0.6" && a.ttl == 60
|
209
|
-
}.
|
207
|
+
}).to_not be_nil
|
210
208
|
|
211
|
-
a_records.detect { |a|
|
209
|
+
expect(a_records.detect { |a|
|
212
210
|
a.host == "test.example.com." && a.address == "10.1.0.1" && a.ttl == 3600
|
213
|
-
}.
|
211
|
+
}).to_not be_nil
|
214
212
|
|
215
|
-
a_records.detect { |a|
|
213
|
+
expect(a_records.detect { |a|
|
216
214
|
a.host == "www.test.example.com." && a.address == "10.1.0.2" && a.ttl == 3600
|
217
|
-
}.
|
215
|
+
}).to_not be_nil
|
218
216
|
end
|
219
217
|
|
220
218
|
it "should build the correct CNAME records" do
|
221
219
|
zone = DNS::Zonefile.load(@zonefile)
|
222
220
|
cname_records = zone.records_of DNS::Zonefile::CNAME
|
223
|
-
cname_records.size.
|
221
|
+
expect(cname_records.size).to eq(9)
|
224
222
|
|
225
|
-
cname_records.detect { |cname|
|
223
|
+
expect(cname_records.detect { |cname|
|
226
224
|
cname.host == "www.example.com." && cname.target == "ns.example.com."
|
227
|
-
}.
|
225
|
+
}).to_not be_nil
|
228
226
|
|
229
|
-
cname_records.detect { |cname|
|
227
|
+
expect(cname_records.detect { |cname|
|
230
228
|
cname.host == "wwwtest.example.com." && cname.domainname == "www.example.com."
|
231
|
-
}.
|
229
|
+
}).to_not be_nil
|
232
230
|
|
233
|
-
cname_records.detect { |cname|
|
231
|
+
expect(cname_records.detect { |cname|
|
234
232
|
cname.host == "www2.example.com." && cname.domainname == "ns.example.com." && cname.ttl == 86400
|
235
|
-
}.
|
233
|
+
}).to_not be_nil
|
236
234
|
|
237
|
-
cname_records.detect { |cname|
|
235
|
+
expect(cname_records.detect { |cname|
|
238
236
|
cname.host == "P229392922.example.com." && cname.domainname == "printer01.ad.example.com." && cname.ttl == 172800
|
239
|
-
}.
|
237
|
+
}).to_not be_nil
|
240
238
|
|
241
239
|
eam_records = cname_records.select { |c| c.host =~ /eam\./ }
|
242
240
|
|
243
|
-
eam_records.
|
241
|
+
expect(eam_records.length).to eq(5)
|
244
242
|
|
245
243
|
eam_records.each { |cname|
|
246
|
-
cname.target.
|
244
|
+
expect(cname.target).to eq("www.example.com.")
|
247
245
|
}
|
248
246
|
|
249
247
|
r = eam_records.group_by { |c| c.ttl }
|
250
|
-
(r[900]
|
251
|
-
(r[86400]
|
248
|
+
expect(r[900].length).to eq(3)
|
249
|
+
expect(r[86400].length).to eq(2)
|
252
250
|
end
|
253
251
|
|
254
252
|
it "should build the correct MX records" do
|
255
253
|
zone = DNS::Zonefile.load(@zonefile)
|
256
254
|
mx_records = zone.records_of DNS::Zonefile::MX
|
257
|
-
mx_records.
|
255
|
+
expect(mx_records.length).to eq(4)
|
258
256
|
|
259
|
-
mx_records.detect { |mx|
|
257
|
+
expect(mx_records.detect { |mx|
|
260
258
|
mx.host == "example.com." && mx.priority == 10 && mx.exchanger == 'mail.example.com.'
|
261
|
-
}.
|
259
|
+
}).to_not be_nil
|
262
260
|
|
263
|
-
mx_records.detect { |mx|
|
261
|
+
expect(mx_records.detect { |mx|
|
264
262
|
mx.host == "example.com." && mx.priority == 20 && mx.exchange == 'mail2.example.com.'
|
265
|
-
}.
|
263
|
+
}).to_not be_nil
|
266
264
|
|
267
|
-
mx_records.detect { |mx|
|
265
|
+
expect(mx_records.detect { |mx|
|
268
266
|
mx.host == "example.com." && mx.priority == 50 && mx.domainname == 'mail3.example.com.' && mx.ttl == 86400
|
269
|
-
}.
|
267
|
+
}).to_not be_nil
|
270
268
|
|
271
|
-
mx_records.detect { |mx|
|
269
|
+
expect(mx_records.detect { |mx|
|
272
270
|
mx.host == "test.example.com." && mx.priority == 10 && mx.domainname == 'mail.example.com.' && mx.ttl == 3600
|
273
|
-
}.
|
271
|
+
}).to_not be_nil
|
274
272
|
end
|
275
273
|
|
276
274
|
it "should build the correct AAAA records" do
|
277
275
|
zone = DNS::Zonefile.load(@zonefile)
|
278
276
|
aaaa_records = zone.records_of DNS::Zonefile::AAAA
|
279
|
-
aaaa_records.
|
277
|
+
expect(aaaa_records.length).to eq(4)
|
280
278
|
|
281
|
-
aaaa_records.detect { |a|
|
279
|
+
expect(aaaa_records.detect { |a|
|
282
280
|
a.host == "example.com." && a.address == "2001:db8:a::1"
|
283
|
-
}.
|
281
|
+
}).to_not be_nil
|
284
282
|
|
285
|
-
aaaa_records.detect { |a|
|
283
|
+
expect(aaaa_records.detect { |a|
|
286
284
|
a.host == "ns.example.com." && a.address == "2001:db8:b::1"
|
287
|
-
}.
|
285
|
+
}).to_not be_nil
|
288
286
|
|
289
|
-
aaaa_records.detect { |a|
|
287
|
+
expect(aaaa_records.detect { |a|
|
290
288
|
a.host == "mail.example.com." && a.address == "2001:db8:c::10.0.0.4" && a.ttl == 86400
|
291
|
-
}.
|
289
|
+
}).to_not be_nil
|
292
290
|
|
293
|
-
aaaa_records.detect { |a|
|
291
|
+
expect(aaaa_records.detect { |a|
|
294
292
|
a.host == "with-age-aaaa.example.com." && a.address == "10.0.0.8" && a.ttl == 60
|
295
|
-
}.
|
293
|
+
}).to_not be_nil
|
296
294
|
|
297
295
|
end
|
298
296
|
|
299
297
|
it "should build the correct NAPTR records" do
|
300
298
|
zone = DNS::Zonefile.load(@zonefile)
|
301
299
|
naptr_records = zone.records_of DNS::Zonefile::NAPTR
|
302
|
-
naptr_records.
|
300
|
+
expect(naptr_records.length).to eq(2)
|
303
301
|
|
304
|
-
naptr_records.detect { |r|
|
302
|
+
expect(naptr_records.detect { |r|
|
305
303
|
r.host == "sip.example.com." && r.data == '100 10 "U" "E2U+sip" "!^.*$!sip:cs@example.com!i" .'
|
306
|
-
}.
|
304
|
+
}).to_not be_nil
|
307
305
|
|
308
|
-
naptr_records.detect { |r|
|
306
|
+
expect(naptr_records.detect { |r|
|
309
307
|
r.host == "sip2.example.com." && r.data == %q{100 10 "" "" "/urn:cid:.+@([^\\.]+\\.)(.*)$/\\2/i" .} && r.ttl == 86400
|
310
|
-
}.
|
308
|
+
}).to_not be_nil
|
311
309
|
end
|
312
310
|
|
313
311
|
it "should build the correct SRV records" do
|
314
312
|
zone = DNS::Zonefile.load(@zonefile)
|
315
313
|
srv_records = zone.records_of DNS::Zonefile::SRV
|
316
|
-
srv_records.
|
314
|
+
expect(srv_records.length).to eq(7)
|
317
315
|
|
318
|
-
srv_records.detect { |r|
|
316
|
+
expect(srv_records.detect { |r|
|
319
317
|
r.host == "_xmpp-server._tcp.example.com." && r.priority == 5 && r.weight == 0 && r.port == 5269 && r.target == 'xmpp-server.l.google.com.' && r.ttl == 86400
|
320
|
-
}.
|
318
|
+
}).to_not be_nil
|
321
319
|
|
322
|
-
|
320
|
+
expect(srv_records.detect { |r|
|
323
321
|
r.host == "_ldap._tcp.pupy._sites.dc._msdcs.example.com." && r.priority == 0 && r.weight == 100 && r.port == 389 && r.target == 'host01.ad.example.com.' && r.ttl == 600
|
324
|
-
}.
|
322
|
+
}).to_not be_nil
|
325
323
|
|
326
324
|
eam_records = srv_records.select { |s| s.host =~ /eam\./ }
|
327
|
-
eam_records.
|
325
|
+
expect(eam_records.length).to eq(5)
|
328
326
|
eam_records.each { |srv|
|
329
|
-
srv.target.
|
330
|
-
srv.priority.
|
331
|
-
srv.port.
|
332
|
-
srv.weight.
|
327
|
+
expect(srv.target).to eq("www.example.com.")
|
328
|
+
expect(srv.priority).to eq(5)
|
329
|
+
expect(srv.port).to eq(5269)
|
330
|
+
expect(srv.weight).to eq(0)
|
333
331
|
}
|
334
332
|
|
335
333
|
r = eam_records.group_by { |c| c.ttl }
|
336
|
-
(r[900]
|
337
|
-
(r[86400]
|
334
|
+
expect(r[900].length).to eq(3)
|
335
|
+
expect(r[86400].length).to eq(2)
|
338
336
|
end
|
339
337
|
|
340
338
|
it "should build the correct TXT records" do
|
341
339
|
zone = DNS::Zonefile.load(@zonefile)
|
342
340
|
txt_records = zone.records_of DNS::Zonefile::TXT
|
343
|
-
txt_records.size.
|
341
|
+
expect(txt_records.size).to eq(6)
|
344
342
|
|
345
|
-
txt_records.detect { |r|
|
343
|
+
expect(txt_records.detect { |r|
|
346
344
|
r.host == "_domainkey.example.com." && r.data == '"v=DKIM1\;g=*\;k=rsa\; p=4tkw1bbkfa0ahfjgnbewr2ttkvahvfmfizowl9s4g0h28io76ndow25snl9iumpcv0jwxr2k"'
|
347
|
-
}.
|
345
|
+
}).to_not be_nil
|
348
346
|
|
349
|
-
txt_records.detect { |r|
|
347
|
+
expect(txt_records.detect { |r|
|
350
348
|
r.host == "with_ms_txt.example.com." && r.data == '"Some text"'
|
351
|
-
}.
|
349
|
+
}).to_not be_nil
|
352
350
|
|
353
|
-
txt_records.detect { |r|
|
351
|
+
expect(txt_records.detect { |r|
|
354
352
|
r.host == "example.com." && r.data == '"some other \"message\" goes here"' && r.ttl == 86400
|
355
|
-
}.
|
353
|
+
}).to_not be_nil
|
356
354
|
|
357
|
-
txt_records.detect { |r|
|
355
|
+
expect(txt_records.detect { |r|
|
358
356
|
r.host == "long.example.com." && r.data == '"a multi-segment TXT record" "usually used for really long TXT records" "since each segment can only span 255 chars"'
|
359
|
-
}.
|
357
|
+
}).to_not be_nil
|
360
358
|
|
361
|
-
txt_records.detect { |r|
|
359
|
+
expect(txt_records.detect { |r|
|
362
360
|
r.host == "unquoted.example.com." && r.data == 'some text data'
|
363
|
-
}.
|
361
|
+
}).to_not be_nil
|
364
362
|
|
365
|
-
txt_records.detect { |r|
|
363
|
+
expect(txt_records.detect { |r|
|
366
364
|
r.host == "multiline.example.com." && r.data == "\"A TXT record\nsplit across multiple lines\nwith LF and CRLF line endings\""
|
367
|
-
}.
|
365
|
+
}).to_not be_nil
|
368
366
|
end
|
369
367
|
|
370
368
|
it "should build the correct SPF records" do
|
371
369
|
zone = DNS::Zonefile.load(@zonefile)
|
372
370
|
spf_records = zone.records_of DNS::Zonefile::SPF
|
373
|
-
spf_records.
|
371
|
+
expect(spf_records.length).to eq(1)
|
374
372
|
|
375
|
-
spf_records.detect { |r|
|
373
|
+
expect(spf_records.detect { |r|
|
376
374
|
r.host == "example.com." && r.data == '"v=spf1 a a:other.domain.com ~all"' && r.ttl == 86400
|
377
|
-
}.
|
375
|
+
}).to_not be_nil
|
378
376
|
end
|
379
377
|
|
380
378
|
it "should build the correct PTR records" do
|
381
379
|
zone = DNS::Zonefile.load(@zonefile)
|
382
380
|
ptr_records = zone.records_of DNS::Zonefile::PTR
|
383
|
-
ptr_records.
|
381
|
+
expect(ptr_records.length).to eq(1)
|
384
382
|
|
385
|
-
ptr_records.detect { |r|
|
383
|
+
expect(ptr_records.detect { |r|
|
386
384
|
r.host == "45.example.com." && r.target == 'example.com.' && r.ttl == 86400
|
387
|
-
}.
|
385
|
+
}).to_not be_nil
|
388
386
|
end
|
389
387
|
end
|
390
388
|
|
@@ -401,15 +399,15 @@ ZONE
|
|
401
399
|
it "should parse the SOA record correctly" do
|
402
400
|
zone = DNS::Zonefile.load(@zonefile)
|
403
401
|
soa = zone.soa
|
404
|
-
soa.klass.
|
405
|
-
soa.ttl.
|
406
|
-
soa.nameserver.
|
407
|
-
soa.responsible_party.
|
408
|
-
soa.serial.
|
409
|
-
soa.refresh_time.
|
410
|
-
soa.retry_time.
|
411
|
-
soa.expiry_time.
|
412
|
-
soa.nxttl.
|
402
|
+
expect(soa.klass).to eql('IN')
|
403
|
+
expect(soa.ttl).to eql(86400)
|
404
|
+
expect(soa.nameserver).to eql('ns0.example.com.')
|
405
|
+
expect(soa.responsible_party).to eql('hostmaster.example.com.')
|
406
|
+
expect(soa.serial).to eql(2006010558)
|
407
|
+
expect(soa.refresh_time).to eql(43200)
|
408
|
+
expect(soa.retry_time).to eql(3600)
|
409
|
+
expect(soa.expiry_time).to eql(1209600)
|
410
|
+
expect(soa.nxttl).to eql(180)
|
413
411
|
end
|
414
412
|
end
|
415
413
|
|
@@ -429,9 +427,9 @@ ZONE
|
|
429
427
|
it "should parse the SOA record correctly" do
|
430
428
|
zone = DNS::Zonefile.load(@zonefile)
|
431
429
|
soa = zone.soa
|
432
|
-
soa.klass.
|
433
|
-
soa.nameserver.
|
434
|
-
soa.responsible_party.
|
430
|
+
expect(soa.klass).to eql('IN')
|
431
|
+
expect(soa.nameserver).to eql('ns.domain.example.com.')
|
432
|
+
expect(soa.responsible_party).to eql('.')
|
435
433
|
end
|
436
434
|
end
|
437
435
|
end
|