ruby-dns-mock

DNS mock server written on 💎 Ruby. Mimic any DNS records for your test environment with fake DNS server.

MIT License

Downloads
83.7K
Stars
65
Committers
1

Bot releases are visible (Hide)

ruby-dns-mock - v1.5.6

Published by bestwebua almost 2 years ago

What's Changed

Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.5...v1.5.6

ruby-dns-mock - v1.5.5

Published by bestwebua about 2 years ago

What's Changed

Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.4...v1.5.5

ruby-dns-mock - v1.5.4

Published by bestwebua about 2 years ago

What's Changed

Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.3...v1.5.4

ruby-dns-mock - v1.5.3

Published by bestwebua over 2 years ago

What's Changed

Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.2...v1.5.3

ruby-dns-mock - v1.5.2

Published by bestwebua over 2 years ago

What's Changed

Full Changelog: https://github.com/mocktools/ruby-dns-mock/compare/v1.5.1...v1.5.2

ruby-dns-mock - v1.5.1: Technical/Update gem development dependencies

Published by bestwebua over 2 years ago

  1. Updated native Ruby test environment from 2.5 to 3.1
  2. Added compatible gemspec
  3. Updated codeclimate/circleci configs
  4. Updated gem development dependencies
  5. Updated gem docs, changelog
  6. Updated gem version to 1.5.1
ruby-dns-mock - v1.5.0: Feature/Ruby 3.1.x compatibility

Published by bestwebua almost 3 years ago

  1. Added Ruby 3.1.x compatibility
  2. Updated rubocop/codeclimate/circleci configs
  3. Updated gem development dependencies
  4. Updated gem docs
  5. Updated gem version to 1.5.0
ruby-dns-mock - v1.4.4: Technical/Update development dependencies

Published by bestwebua almost 3 years ago

  1. Updated gem development dependencies
  2. Updated rubocop config
  3. Updated gem version to 1.4.4
ruby-dns-mock - v1.4.3: Technical/Update development dependencies

Published by bestwebua about 3 years ago

  1. Updated gem development dependencies
  2. Updated rubocop/codeclimate configs
  3. Updated gem version to 1.4.3
ruby-dns-mock - v1.4.2: Technical/Update development dependencies

Published by bestwebua about 3 years ago

  1. Updated gem development dependencies
  2. Updated codeclimate config
  3. Updated gem version to 1.4.2
ruby-dns-mock - v1.4.1: Technical/Update development dependencies

Published by bestwebua about 3 years ago

  1. Updated gem development dependencies
  2. Changed faker to ffaker
  3. Updated rubocop/codeclimate configs
  4. Updated gem version to 1.4.1
ruby-dns-mock - v1.4.0: Feature/Ability to use internationalized hostnames

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
  1. Added simpleidn as runtime dependency
  2. Implemented DnsMock::Representer::Punycode, tests
  3. Refactored DnsMock::Representer::RdnsLookup, tests
  4. Updated DnsMock::Record::Factory::Base
  5. Updated DnsMock::Server::RecordsDictionaryBuilder, tests
  6. Updated DnsMock::Record::Factory::Cname, tests
  7. Updated DnsMock::Record::Factory::Mx, tests
  8. Updated DnsMock::Record::Factory::Ns, tests
  9. Updated DnsMock::Record::Factory::Ptr, tests
  10. Updated DnsMock::Record::Factory::Soa, tests
  11. Updated DnsMock::ContextGeneratorHelper, tests
  12. Updated reek config
  13. Updated gem documentation
  14. Updated gem version to 1.4.0
ruby-dns-mock - v1.3.1: Technical/Update development dependencies

Published by bestwebua over 3 years ago

  1. Updated gem development dependencies
  2. Updated rubocop/codeclimate configs
  3. Updated documentation
  4. Updated gem version to 1.3.1
ruby-dns-mock - v1.3.0: Feature/Detecting random available port via OS features

Published by bestwebua over 3 years ago

Thanks @ioquatix for this suggestion.

  1. Removed DnsMock::Server::RandomAvailablePort
  2. DnsMock::Server, tests
  3. Fixed test coverage issues
  4. Updated test helpers/tests
  5. Updated gem development dependencies
  6. Updated Codeclimate, Simplecov config
  7. Updated gem documentation
  8. Updated gem version to 1.3.0
ruby-dns-mock - v1.2.4: Technical/Update development dependencies

Published by bestwebua over 3 years ago

  1. Updated gem development dependencies
  2. Updated Codeclimate, CircleCI config
  3. Updated gem version to 1.2.4
ruby-dns-mock - v1.2.3: Technical/Update development dependencies

Published by bestwebua over 3 years ago

  1. Updated gem development dependencies
  2. Updated CircleCI config
  3. Updated gem version to 1.2.3
ruby-dns-mock - v1.2.2: Technical/Update development dependencies

Published by bestwebua over 3 years ago

  1. Updated gem development dependencies
  2. Updated rubocop/codeclimate config
  3. Updated gem version to 1.2.2
ruby-dns-mock - v1.2.1: Technical/Update development dependencies

Published by bestwebua over 3 years ago

  1. Updated gem development dependencies
  2. Updated rubocop/codeclimate config
  3. Updated gem documentation
  4. Updated tests
  5. Updated gem version to 1.2.1
ruby-dns-mock - v1.2.0: Feature/Ability to specify MX record priority

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
  1. Updated DnsMock::Record::Builder::Mx
  2. Updated readme, changelog
  3. Updated gem version to 1.2.0
ruby-dns-mock - v1.1.0: Feature/RSpec integration

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
  1. Added DnsMock::TestFramework::RSpec::Interface, tests
  2. Added DnsMock::TestFramework::RSpec::Helper, tests
  3. Added RSpec DnsMock config
  4. Updated readme, changelog
  5. Updated gem version to 1.1.0
Package Rankings
Top 6.72% on Proxy.golang.org
Top 10.14% on Rubygems.org
Badges
Extracted from project README
Maintainability Test Coverage CircleCI Gem Version Downloads In Awesome Ruby GitHub Contributor Covenant