Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ New config option to return frozen dup from #responses [backport: #334] #339

Merged
merged 8 commits into from
Oct 13, 2024

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Oct 13, 2024

Backports #334 from master (0.5.0-dev).

I tried using markdown for the tables, but it screwed up other
formatting.  This format (with definition lists) is more "standard" for
rdoc.
`test_imap.rb` is huge!

`wait_for_response_count` was moved into TestCase (in test/lib/helper).
Perhaps this should be moved into a shared module or an IMAPTestCase
class (subclass of TestCase) instead?
Two args (counting the block arg) => four tests.

Only the original (no args) form is affected by
`config.responses_without_block`, so the others make their assertions
for every possible config setting.
The same message is used for both the warning and the ArgumentError.
Because responses(type) is relatively new and has always raised an
exception, we can update it to return a frozen dup array without
breaking backward compatibility.

Additionally, `config.responses_without_args` was added as an alias for
`config.responses_without_block`.  The original name is a little
misleading now, but it's kept for backward compatibility.
This adds a new `:frozen_dup` option to `config.responses_without_block`
which allows it to return a frozen copy of the responses hash, with each
response type array also being a frozen copy.
This seems like a better API than _always_ crashing.  Now that we have a
config option for it, it should become the default in v0.6.
@nevans nevans force-pushed the backport/0.4/334/responses-return-frozen_dup branch from ca2e2c9 to 0c8df40 Compare October 13, 2024 12:35
@nevans nevans merged commit bb4a2c9 into v0.4-stable Oct 13, 2024
26 checks passed
@nevans nevans deleted the backport/0.4/334/responses-return-frozen_dup branch October 13, 2024 12:42
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