From ab1cc87d65d82f8bf8a283e75051923fe9c9bd83 Mon Sep 17 00:00:00 2001 From: Hiroshi Ota Date: Sun, 1 Feb 2015 06:55:11 +0900 Subject: [PATCH] Add spec for reverse look up with in_zone_file chain --- spec/rspec-dns/0.2.0.192.rev.zone | 11 +++++++++++ spec/rspec-dns/have_dns_spec.rb | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 spec/rspec-dns/0.2.0.192.rev.zone diff --git a/spec/rspec-dns/0.2.0.192.rev.zone b/spec/rspec-dns/0.2.0.192.rev.zone new file mode 100644 index 0000000..f0531aa --- /dev/null +++ b/spec/rspec-dns/0.2.0.192.rev.zone @@ -0,0 +1,11 @@ +$TTL 86400 + +@ IN SOA ns.example.com. root.example.com. ( + 2015020102 ; Serial + 3600 ; Refresh + 900 ; Retry + 604800 ; Expire + 900 ; Minimum + ) + IN NS ns.example.com. +4 IN PTR www.example.com. diff --git a/spec/rspec-dns/have_dns_spec.rb b/spec/rspec-dns/have_dns_spec.rb index b2b08b4..f1a699c 100644 --- a/spec/rspec-dns/have_dns_spec.rb +++ b/spec/rspec-dns/have_dns_spec.rb @@ -140,6 +140,23 @@ def stub_records(strings) .and_address('2001:DB8:6C::430') .in_zone_file(file, origin) end + context 'in reverse' do + it 'can evalutate PTR records in zone file' do + file = 'spec/rspec-dns/0.2.0.192.rev.zone' + origin = '2.0.192.in-addr.arpa.' + + expect('4.2.0.192.in-addr.arpa').to have_dns.with_type('PTR') + .and_domainname('www.example.com') + .in_zone_file(file, origin) + expect('5.2.0.192.in-addr.arpa').not_to have_dns.with_type('PTR') + .and_domainname('www.example.com') + .in_zone_file(file, origin) + expect('192.0.2.4').to have_dns.with_type('PTR') + .and_domainname('www.example.com') + .in_zone_file(file, origin) + end + end + it 'can evalutate records in zone file without origin' do file = 'spec/rspec-dns/example.zone'