File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ def find_class_and_command_by_namespace(namespace, fallback = true)
133133 *pieces , command = namespace . split ( ":" )
134134 namespace = pieces . join ( ":" )
135135 namespace = "default" if namespace . empty?
136- klass = Thor ::Base . subclasses . detect { |thor | thor . namespace == namespace && thor . commands . keys . include ?( command ) }
136+ klass = Thor ::Base . subclasses . detect { |thor | thor . namespace == namespace && thor . command_exists ?( command ) }
137137 end
138138 unless klass # look for a Thor::Group with the right name
139139 klass = Thor ::Util . find_by_namespace ( namespace )
Original file line number Diff line number Diff line change @@ -114,6 +114,14 @@ def self.clear_user_home!
114114 expect ( Thor ::Util . find_class_and_command_by_namespace ( "fruits:apple" ) ) . to eq ( [ Apple , "apple" ] )
115115 expect ( Thor ::Util . find_class_and_command_by_namespace ( "fruits:pear" ) ) . to eq ( [ Pear , "pear" ] )
116116 end
117+
118+ it "returns correct Thor class and the command name with hypen when shared namespaces" do
119+ expect ( Thor ::Util . find_class_and_command_by_namespace ( "fruits:rotten-apple" ) ) . to eq ( [ Apple , "rotten-apple" ] )
120+ end
121+
122+ it "returns correct Thor class and the associated alias command name when shared namespaces" do
123+ expect ( Thor ::Util . find_class_and_command_by_namespace ( "fruits:ra" ) ) . to eq ( [ Apple , "ra" ] )
124+ end
117125 end
118126
119127 describe "#thor_classes_in" do
You can’t perform that action at this time.
0 commit comments