`make test-all RUBYOPT=-w` in the ruby/ruby repo printed the warning.
This change prevents the warning by specifying the content-type
explicitly.
A follow-up to b70c1bb150d573af07f6
If a command requires two MFA authenticated requests, and webauthn is
enabled, then first one will succeed but the second one will fail
because it tries to reuse the OTP code from the first request and that
does not work.
This happens when you have not yet logged in to rubygems.org, or when
you have an API key with invalid scopes for the current operation. In
that case, we need:
* An API request to get a token or change scopes for the one that you
have.
* Another API request to perform the actual operation.
Instead of trying to reuse the token, make sure it's cleared so we are
asked to authenticate again. We only do this when webauthn is enabled
because reusing TOPT tokens otherwise is allowed and I don't want to
break that.
669e343935
The `initialize` method is already doing a lot and by adding the `Gem::PrintableUri` to redact sensitive information, things are getting complicated and hard to read here. For the start, I have refactored the `initialize` method into a class method called `build`.
4312e8fdf5
This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".
The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:
```
t.test_files = FileList['test/**/test_*.rb']
```
Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820971, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.
Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.
6460e018df
2021-06-03 12:23:22 +09:00
Renamed from test/rubygems/test_utilities.rb (Browse further)