Skip to content

TEST: explicitly require stringio #340

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

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

mtasaka
Copy link
Contributor

@mtasaka mtasaka commented Nov 8, 2024

Since spec/spec_helper.rb uses StringIO class,
make this file explicitly require stringio.

Since spec/spec_helper.rb uses StringIO class,
make this file explicitly require stringio.
@mtasaka
Copy link
Contributor Author

mtasaka commented Nov 8, 2024

Testing with

  • ruby 3.4.0dev (2024-11-07 master df3395f2e3) +PRISM [x86_64-linux] ruby/ruby@df3395f

Executing bson-ruby head
e1f5d8f
rspec testsuite with ~/.spec removed generates the following error:

$ env RUBYLIB=$(pwd)/lib:$(pwd)/ext/bson/ rspec

An error occurred while loading ./spec/bson/array_spec.rb.
Failure/Error:
  class AlternateIO < StringIO
  
    # Read a byte from the stream.
    #
    # @returns [ String ] A String representation of the next byte.
    def readbyte
      super.chr
    end

NameError:
  uninitialized constant StringIO
# ./spec/spec_helper.rb:68:in '<top (required)>'
# ./spec/bson/array_spec.rb:16:in '<top (required)>'


Finished in 0.00055 seconds (files took 2.75 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

With ~/.spec restored, the following error does not happen, perhaps because loading rspec format style somewhere loads stringio internally in rspec. But anyway I think explicitly adding stringio dependency inside bson-ruby is desirable.

@comandeo-mongo comandeo-mongo self-requested a review December 10, 2024 16:26
@comandeo-mongo comandeo-mongo merged commit fac91a9 into mongodb:master Dec 10, 2024
1 check was pending
@comandeo-mongo
Copy link
Contributor

@mtasaka Thank you very much for your contribution!

@jamis jamis added the bug Fixes a bug, with no new features or broken compatibility label Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes a bug, with no new features or broken compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants