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 spec to prove subclass with an argument specified has borken help #1

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions spec/fixtures/subcommand.thor
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions spec/subcommand_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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