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

Support Ruby 3.4 Hash#inspect change #887

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

yahonda
Copy link
Member

@yahonda yahonda commented Oct 30, 2024

This commit addresses the following failures against Ruby 3.4.0dev that includes ruby/ruby#10924 . This commit also passes specs againt Ruby 3.3.5.

$ ruby -v
ruby 3.4.0dev (2024-10-26T13:20:34Z master 484ea00d2e) +PRISM [x86_64-linux]
$ bundle exec rspec ./spec/thor_spec.rb
Source locally installed gems is ignoring #<Bundler::StubSpecification name=prism version=1.0.0 platform=ruby> because it is missing extensions
Source locally installed gems is ignoring #<Bundler::StubSpecification name=json version=2.7.2 platform=ruby> because it is missing extensions
Source locally installed gems is ignoring #<Bundler::StubSpecification name=google-protobuf version=4.27.0 platform=ruby> because it is missing extensions
Source locally installed gems is ignoring #<Bundler::StubSpecification name=cgi version=0.4.1 platform=ruby> because it is missing extensions
rdoc was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add rdoc to your Gemfile or gemspec to silence this warning.
........................................................................................................FF.........

Failures:

  1) Thor edge-cases method_option raises an ArgumentError if name is not a Symbol or String
     Failure/Error:
       expect do
         Class.new(Thor) do
           method_option loud: true, type: :boolean
         end
       end.to raise_error(ArgumentError, "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}")

       expected ArgumentError with "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}", got #<ArgumentError: Expected a Symbol or String, got {loud: true, type: :boolean}> with backtrace:
         # ./lib/thor.rb:165:in 'Thor.method_option'
         # ./spec/thor_spec.rb:768:in 'block (5 levels) in <top (required)>'
         # ./spec/thor_spec.rb:767:in 'Class#initialize'
         # ./spec/thor_spec.rb:767:in 'Class#new'
         # ./spec/thor_spec.rb:767:in 'block (4 levels) in <top (required)>'
         # ./spec/thor_spec.rb:770:in 'block (3 levels) in <top (required)>'
     # ./spec/thor_spec.rb:770:in 'block (3 levels) in <top (required)>'

  2) Thor edge-cases class_option raises an ArgumentError if name is not a Symbol or String
     Failure/Error:
       expect do
         Class.new(Thor) do
           class_option loud: true, type: :boolean
         end
       end.to raise_error(ArgumentError, "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}")

       expected ArgumentError with "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}", got #<ArgumentError: Expected a Symbol or String, got {loud: true, type: :boolean}> with backtrace:
         # ./lib/thor/base.rb:330:in 'Thor::Base::ClassMethods#class_option'
         # ./spec/thor_spec.rb:776:in 'block (5 levels) in <top (required)>'
         # ./spec/thor_spec.rb:775:in 'Class#initialize'
         # ./spec/thor_spec.rb:775:in 'Class#new'
         # ./spec/thor_spec.rb:775:in 'block (4 levels) in <top (required)>'
         # ./spec/thor_spec.rb:778:in 'block (3 levels) in <top (required)>'
     # ./spec/thor_spec.rb:778:in 'block (3 levels) in <top (required)>'

Finished in 0.0627 seconds (files took 0.26431 seconds to load)
115 examples, 2 failures

Failed examples:

rspec ./spec/thor_spec.rb:765 # Thor edge-cases method_option raises an ArgumentError if name is not a Symbol or String
rspec ./spec/thor_spec.rb:773 # Thor edge-cases class_option raises an ArgumentError if name is not a Symbol or String

Coverage report generated for RSpec to /home/yahonda/src/github.com/rails/thor/coverage.
Line Coverage: 67.3% (1490 / 2214)
[Coveralls] Submitting to https://coveralls.io/api/v1
[Coveralls] Couldn't find a repository matching this job.
Coverage is at 67.3%.
Coverage report sent to Coveralls.
Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected
$

Refer to:
ruby/ruby#10924
https://bugs.ruby-lang.org/issues/20433

This commit addresses the following failures against Ruby 3.4.0dev that includes ruby/ruby#10924 .

It also uses Ruby 1.9 style hash syntax to address `Style/HashSyntax: Use the new Ruby 1.9 hash syntax.` offenses
as per reported https://github.com/rails/thor/actions/runs/11590597621/job/32268507033?pr=887

```ruby
$ ruby -v
ruby 3.4.0dev (2024-10-26T13:20:34Z master 484ea00d2e) +PRISM [x86_64-linux]
$ bundle exec rspec ./spec/thor_spec.rb
Source locally installed gems is ignoring #<Bundler::StubSpecification name=prism version=1.0.0 platform=ruby> because it is missing extensions
Source locally installed gems is ignoring #<Bundler::StubSpecification name=json version=2.7.2 platform=ruby> because it is missing extensions
Source locally installed gems is ignoring #<Bundler::StubSpecification name=google-protobuf version=4.27.0 platform=ruby> because it is missing extensions
Source locally installed gems is ignoring #<Bundler::StubSpecification name=cgi version=0.4.1 platform=ruby> because it is missing extensions
rdoc was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add rdoc to your Gemfile or gemspec to silence this warning.
........................................................................................................FF.........

Failures:

  1) Thor edge-cases method_option raises an ArgumentError if name is not a Symbol or String
     Failure/Error:
       expect do
         Class.new(Thor) do
           method_option loud: true, type: :boolean
         end
       end.to raise_error(ArgumentError, "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}")

       expected ArgumentError with "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}", got #<ArgumentError: Expected a Symbol or String, got {loud: true, type: :boolean}> with backtrace:
         # ./lib/thor.rb:165:in 'Thor.method_option'
         # ./spec/thor_spec.rb:768:in 'block (5 levels) in <top (required)>'
         # ./spec/thor_spec.rb:767:in 'Class#initialize'
         # ./spec/thor_spec.rb:767:in 'Class#new'
         # ./spec/thor_spec.rb:767:in 'block (4 levels) in <top (required)>'
         # ./spec/thor_spec.rb:770:in 'block (3 levels) in <top (required)>'
     # ./spec/thor_spec.rb:770:in 'block (3 levels) in <top (required)>'

  2) Thor edge-cases class_option raises an ArgumentError if name is not a Symbol or String
     Failure/Error:
       expect do
         Class.new(Thor) do
           class_option loud: true, type: :boolean
         end
       end.to raise_error(ArgumentError, "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}")

       expected ArgumentError with "Expected a Symbol or String, got {:loud=>true, :type=>:boolean}", got #<ArgumentError: Expected a Symbol or String, got {loud: true, type: :boolean}> with backtrace:
         # ./lib/thor/base.rb:330:in 'Thor::Base::ClassMethods#class_option'
         # ./spec/thor_spec.rb:776:in 'block (5 levels) in <top (required)>'
         # ./spec/thor_spec.rb:775:in 'Class#initialize'
         # ./spec/thor_spec.rb:775:in 'Class#new'
         # ./spec/thor_spec.rb:775:in 'block (4 levels) in <top (required)>'
         # ./spec/thor_spec.rb:778:in 'block (3 levels) in <top (required)>'
     # ./spec/thor_spec.rb:778:in 'block (3 levels) in <top (required)>'

Finished in 0.0627 seconds (files took 0.26431 seconds to load)
115 examples, 2 failures

Failed examples:

rspec ./spec/thor_spec.rb:765 # Thor edge-cases method_option raises an ArgumentError if name is not a Symbol or String
rspec ./spec/thor_spec.rb:773 # Thor edge-cases class_option raises an ArgumentError if name is not a Symbol or String

Coverage report generated for RSpec to /home/yahonda/src/github.com/rails/thor/coverage.
Line Coverage: 67.3% (1490 / 2214)
[Coveralls] Submitting to https://coveralls.io/api/v1
[Coveralls] Couldn't find a repository matching this job.
Coverage is at 67.3%.
Coverage report sent to Coveralls.
Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected
$
```

ruby/ruby#10924
https://bugs.ruby-lang.org/issues/20433
@yahonda yahonda merged commit b19962a into rails:main Oct 30, 2024
8 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.

1 participant