Skip to content

v1.1.0: Feature/RSpec integration

Choose a tag to compare

@bestwebua bestwebua released this 01 Feb 22:03
· 128 commits to master since this release
819726d

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