Skip to content

Fix a Thor-related issue - #2916

Merged
JonRowe merged 2 commits into
mainfrom
fix-thor
Sep 1, 2026
Merged

JonRowe merged 2 commits into
mainfrom
fix-thor

Conversation

@pirj

@pirj pirj commented Aug 27, 2026

Copy link
Copy Markdown
Member
 Thor::UndefinedCommandError:
   Could not find command "mountable_engine?".
 # ./.bundle/gems/ruby/3.4.0/gems/thor-1.5.0/lib/thor/base.rb:615:in 'Thor::Base::ClassMethods#handle_no_command_error'

Keep the stubbed mountable_engine? out of Thor's command list

Thor turns every public instance method defined on a generator into a command and runs all of them on invoke_all

Wrap the stub in no_commands, Thor's own escape hatch for defining methods that are not commands.

As seen in eg https://github.com/rspec/rspec-rails/actions/runs/33024598274/job/98418758302?pr=2914

     Thor::UndefinedCommandError:
       Could not find command "mountable_engine?".
     # ./.bundle/gems/ruby/3.4.0/gems/thor-1.5.0/lib/thor/base.rb:615:in 'Thor::Base::ClassMethods#handle_no_command_error'

Keep the stubbed `mountable_engine?` out of Thor's command list

Thor turns every public instance method defined on a generator into a command
and runs all of them on `invoke_all`

Wrap the stub in `no_commands`, Thor's own escape hatch for defining methods
that are not commands.
@pirj pirj self-assigned this Aug 27, 2026
Copilot AI lite review requested due to automatic review settings August 27, 2026 16:57

This comment was marked as low quality.

@pirj
pirj requested a review from JonRowe August 27, 2026 17:02
Comment thread spec/generators/rspec/scaffold/scaffold_generator_spec.rb Outdated
@JonRowe
JonRowe merged commit 41558da into main Sep 1, 2026
12 of 14 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.

3 participants