DNS mock server written on 💎 Ruby. Mimic any DNS records for your test environment with fake DNS server.
MIT License
Bot releases are hidden (Show)
Published by bestwebua almost 2 years ago
Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.5...v1.5.6
Published by bestwebua about 2 years ago
Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.4...v1.5.5
Published by bestwebua about 2 years ago
Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.3...v1.5.4
Published by bestwebua over 2 years ago
Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.2...v1.5.3
Published by bestwebua over 2 years ago
Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.1...v1.5.2
Published by bestwebua over 2 years ago
2.5
to 3.1
1.5.1
Published by bestwebua almost 3 years ago
1.5.0
Published by bestwebua almost 3 years ago
1.4.4
Published by bestwebua about 3 years ago
1.4.3
Published by bestwebua about 3 years ago
1.4.2
Published by bestwebua about 3 years ago
faker
to ffaker
1.4.1
Published by bestwebua over 3 years ago
Added ability to use internationalized hostnames. All hostnames in UTF-8 will be represented as Punycode.
DnsMock.start_server(port: 5300, records: { 'mañana.com' => { mx: %w[másletras.mañana.com] })
dig @localhost -p 5300 MX xn--maana-pta.com
; <<>> DiG 9.10.6 <<>> @localhost -p 5300 MX xn--maana-pta.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4612
;; flags: rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;xn--maana-pta.com. IN MX
;; ANSWER SECTION:
xn--maana-pta.com. 1 IN MX 10 xn--msletras-8ya.xn--maana-pta.com.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Tue Jul 13 15:38:47 EEST 2021
;; MSG SIZE rcvd: 79
simpleidn
as runtime dependencyDnsMock::Representer::Punycode
, testsDnsMock::Representer::RdnsLookup
, testsDnsMock::Record::Factory::Base
DnsMock::Server::RecordsDictionaryBuilder
, testsDnsMock::Record::Factory::Cname
, testsDnsMock::Record::Factory::Mx
, testsDnsMock::Record::Factory::Ns
, testsDnsMock::Record::Factory::Ptr
, testsDnsMock::Record::Factory::Soa
, testsDnsMock::ContextGeneratorHelper
, tests1.4.0
Published by bestwebua over 3 years ago
1.3.1
Published by bestwebua over 3 years ago
Thanks @ioquatix for this suggestion.
DnsMock::Server::RandomAvailablePort
DnsMock::Server
, tests1.3.0
Published by bestwebua over 3 years ago
1.2.4
Published by bestwebua over 3 years ago
1.2.3
Published by bestwebua over 3 years ago
1.2.2
Published by bestwebua over 3 years ago
1.2.1
Published by bestwebua over 3 years ago
Added ability to specify custom priority of MX record if it needed. Now it impossible to define null or backup MX records. Please note, if you haven't specified a priority of MX record, it will be assigned automatically. MX records builder is assigning priority with step 10 from first item of defined MX records array.
require 'dns_mock'
records = {
'example.com' => {
mx: %w[.:0 mx1.domain.com:10 mx2.domain.com:10 mx3.domain.com]
}
}
DnsMock.start_server(records: records, port: 5300)
dig @localhost -p 5300 MX example.com
; <<>> DiG 9.10.6 <<>> @localhost -p 5300 MX example.com
;; ANSWER SECTION:
example.com. 1 IN MX 0 .
example.com. 1 IN MX 10 mx1.domain.com.
example.com. 1 IN MX 10 mx2.domain.com.
example.com. 1 IN MX 40 mx3.domain.com.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Wed Feb 03 20:19:51 EET 2021
;; MSG SIZE rcvd: 102
DnsMock::Record::Builder::Mx
1.2.0
Published by bestwebua over 3 years ago
Added DnsMock helper which can simplify integration with RSpec:
# spec/support/config/dns_mock.rb
require 'dns_mock/test_framework/rspec'
RSpec.configure do |config|
config.include DnsMock::TestFramework::RSpec::Helper
end
# your awesome first_a_record_spec.rb
RSpec.describe FirstARecord do
subject(:service) do
described_class.call(
hostname,
dns_gateway_host: 'localhost',
dns_gateway_port: dns_mock_server.port
)
end
let(:hostname) { 'example.com' }
let(:first_a_record) { '1.2.3.4' }
let(:records) { { hostname => { a: [first_a_record] } } }
before { dns_mock_server.assign_mocks(records) }
it { is_expected.to eq(first_a_record) }
end
DnsMock::TestFramework::RSpec::Interface
, testsDnsMock::TestFramework::RSpec::Helper
, testsDnsMock
config1.1.0