Skip to content

Commit

Permalink
🔊 Warn about deprecated responses usage
Browse files Browse the repository at this point in the history
This was extracted from #93 and split into a separate PR.

This allows us to prepare dependent projects for the new behavior before
their logs are flooded with deprecation warnings.
  • Loading branch information
nevans committed Nov 7, 2023
1 parent f27dd4c commit 6a2cd22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@ def responses(type = nil)
elsif type
raise ArgumentError, "Pass a block or use #clear_responses"
else
# warn("DEPRECATED: pass a block or use #clear_responses", uplevel: 1)
warn("DEPRECATED: pass a block or use #clear_responses", uplevel: 1)
@responses
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/net/imap/test_imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1086,10 +1086,10 @@ def test_responses
assert_equal(1, imap.responses("RECENT", &:last))
assert_raise(ArgumentError) do imap.responses("UIDNEXT") end
# Deprecated style, without a block:
# assert_warn(/Pass a block.*or.*clear_responses/i) do
# assert_equal(%i[Answered Flagged Deleted Seen Draft],
# imap.responses["FLAGS"]&.last)
# end
assert_warn(/Pass a block.*or.*clear_responses/i) do
assert_equal(%i[Answered Flagged Deleted Seen Draft],
imap.responses["FLAGS"]&.last)
end
end
end

Expand Down

0 comments on commit 6a2cd22

Please sign in to comment.