Skip to content

Fix: assign_mocks should update records regardless of current state#161

Open
prjanitor wants to merge 1 commit intomocktools:masterfrom
prjanitor:prjanitor/96bbe029656c72c202e5733d43e66fc2cc1de425
Open

Fix: assign_mocks should update records regardless of current state#161
prjanitor wants to merge 1 commit intomocktools:masterfrom
prjanitor:prjanitor/96bbe029656c72c202e5733d43e66fc2cc1de425

Conversation

@prjanitor
Copy link
Copy Markdown

Problem

The assign_mocks method in lib/dns_mock/server.rb only updates the records hash when it is currently empty:

def assign_mocks(new_records)
  !!self.records = records_dictionary_builder.call(new_records) if records.empty?
end

This prevents users from updating existing mock configurations after the server has been initialized with records.

Solution

Remove the conditional check so that assign_mocks always updates the records:

def assign_mocks(new_records)
  !!self.records = records_dictionary_builder.call(new_records)
end

Impact

  • Users can now update mock DNS records at any time, not just when the records hash is empty
  • This is the expected behavior for a method named assign_mocks - it should assign/update the mocks

This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant