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

Add support for Ruby 3.0.z #86

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add support for Ruby 3.0.z #86

wants to merge 9 commits into from

Conversation

vsppedro
Copy link
Collaborator

@vsppedro vsppedro commented Jul 22, 2023

  • Bump Minitest to 5.18.1
  • Add support for Ruby 3.0.6

TODO:

  • Update Rubocop
  • Update dependencies
  • Fix CI

Error in CI:

Error:
RerunSnippetTest#test_: A Rails application with shoulda-context added to it should display the correct rerun snippet when a test fails. :
NoMethodError: undefined method `scan' for {:env=>{:TESTOPTS=>"-v"}}:Hash
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/3.0.0/shellwords.rb:91:in `shellsplit'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:145:in `block in command'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:144:in `each'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:144:in `flat_map'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:144:in `command'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:154:in `run'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:38:in `call'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:38:in `block in initialize'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:160:in `run_with_wrapper'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:167:in `run_with_debugging'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:73:in `block (2 levels) in call'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:188:in `possibly_running_quickly'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:72:in `block in call'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:194:in `possibly_retrying'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:71:in `call'
    <internal:kernel>:90:in `tap'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/command_runner.rb:12:in `run'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/project_command_runner.rb:57:in `run'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/project_command_runner.rb:31:in `run_rake_tasks'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/snowglobe-0.3.0/lib/snowglobe/project_command_runner.rb:16:in `run_n_unit_test_suite'
    /home/pedro/.rbenv/versions/3.0.6/lib/ruby/3.0.0/forwardable.rb:238:in `run_n_unit_test_suite'
    /media/pedro/b6676fde-69fd-45ee-a934-d39abc17cec44/pedro/tempo-livre/collaborator/shoulda-context/test/shoulda/rerun_snippet_test.rb:20:in `block (2 levels) in <class:RerunSnippetTest>'
    /media/pedro/b6676fde-69fd-45ee-a934-d39abc17cec44/pedro/tempo-livre/collaborator/shoulda-context/test/shoulda/rerun_snippet_test.rb:13:in `instance_exec'
    /media/pedro/b6676fde-69fd-45ee-a934-d39abc17cec44/pedro/tempo-livre/collaborator/shoulda-context/test/shoulda/rerun_snippet_test.rb:13:in `block in create_test_from_should_hash'

@vsppedro vsppedro changed the title Ruby 3 Add support for Ruby 3.0.z Jul 22, 2023
@corincerami
Copy link

I think you may need to change method_missing here to:

      def method_missing(method, *args, **kwargs, &blk)
        test_unit_class.send(method, *args, **kwargs, &blk)
      end

We had to monkeypatch this in our application as Ruby 3 no longer supports passing keyword arguments as regular arguments or a Hash.

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