Skip to content

Remove SecurityBuffer#value before redefining it in test_auth.rb - #487

Merged
yyuu merged 1 commit into
nahi:masterfrom
yahonda:fix-warnings
Nov 2, 2026
Merged

yyuu merged 1 commit into
nahi:masterfrom
yahonda:fix-warnings

Conversation

@yahonda

@yahonda yahonda commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

test/test_auth.rb redefines Net::NTLM::SecurityBuffer#value without removing the original method first, which emits method redefined; discarding old value. This removes the method before redefining it, as is already done for data_size.

The other warnings originally addressed here were fixed by #488.

@yyuu

yyuu commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Ugh, sorry I have already addressed mostly-equivalent fixes (+CI improvements) on #488. I should have checked yours carefully beforehand... 🤦

Comment thread test/test_auth.rb
@active && @value ? @value.size : 0
end

remove_method(:value) if method_defined?(:value)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not actually included in #488. It'd be still worthwhile to accept this change.... 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking. I've rebased this onto master and dropped the commits already covered by #488, so this pull request now only contains the SecurityBuffer#value change.

It removes the original method before redefining it, the same way data_size already is, to silence method redefined; discarding old value.

remove_method(:data_size) if method_defined?(:data_size)
def data_size
@active && @value ? @value.size : 0
end

Avoids the following warning, matching how data_size is already
redefined:

    test/test_auth.rb:131: warning: method redefined; discarding old value
    vendor/bundle/ruby/4.0.0/bundler/gems/rubyntlm-59ac920c56d8/lib/net/ntlm/security_buffer.rb:33: warning: previous definition of value was here

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yahonda yahonda changed the title Fix warnings emitted from httpclient's own code in CI Remove SecurityBuffer#value before redefining it in test_auth.rb Nov 2, 2026

@yyuu yyuu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍 CI failures are not something derived from changes, but it’d be just some flakiness of current test setup. Will address it separately….

@yyuu
yyuu merged commit b3615ab into nahi:master Nov 2, 2026
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants