diff --git a/spec/fixtures/subcommand.thor b/spec/fixtures/subcommand.thor index 35d0b5742..3aba62b40 100644 --- a/spec/fixtures/subcommand.thor +++ b/spec/fixtures/subcommand.thor @@ -7,9 +7,22 @@ module TestSubcommands end end + class SubcommandWithArgument < Thor + argument :arg, type: :string + + desc "print_arg", "My method with a cool argument" + def print_arg + print "cool feature\n" + end + end + class Parent < Thor class_option "opt" + + desc "arg", "My subcommand with argument" + subcommand "with_arg", SubcommandWithArgument + desc "sub", "My subcommand" subcommand "sub", Subcommand end diff --git a/spec/subcommand_spec.rb b/spec/subcommand_spec.rb index f189f2172..07af8355d 100644 --- a/spec/subcommand_spec.rb +++ b/spec/subcommand_spec.rb @@ -43,6 +43,13 @@ sub_help = capture(:stdout) { TestSubcommands::Parent.start(%w[help sub])} expect(output).to eq(sub_help) end + + context 'when a subcommand as an argument defined' do + it "the specific subcommand help should be displayed" do + output = capture(:stdout) { TestSubcommands::Parent.start(%w[with_arg help print_arg])} + expect(output).to include("Usage:") + end + end end end