test/tc_help.rb in gli-2.5.3 vs test/tc_help.rb in gli-2.5.4
- old
+ new
@@ -8,10 +8,14 @@
@real_columns = ENV['COLUMNS']
ENV['COLUMNS'] = '1024'
@output = StringIO.new
@error = StringIO.new
@command_names_used = []
+ # Reset help command to its default state
+ GLI::Commands::Help.skips_pre = true
+ GLI::Commands::Help.skips_post = true
+ GLI::Commands::Help.skips_around = true
end
def teardown
ENV['COLUMNS'] = @real_columns
end
@@ -30,9 +34,38 @@
assert_equal 'command',@command.arguments_description
assert_not_nil @command.description
assert_not_nil @command.long_description
assert @command.skips_pre
assert @command.skips_post
+ assert @command.skips_around
+ }
+ end
+
+ test_that "the help command can be configured to skip things declaratively" do
+ Given {
+ @command = GLI::Commands::Help.new(TestApp.new,@output,@error)
+ GLI::Commands::Help.skips_pre = false
+ GLI::Commands::Help.skips_post = false
+ GLI::Commands::Help.skips_around = false
+ }
+ Then {
+ assert !@command.skips_pre
+ assert !@command.skips_post
+ assert !@command.skips_around
+ }
+ end
+
+ test_that "the help command can be configured to skip things declaratively regardless of when it the object was created" do
+ Given {
+ GLI::Commands::Help.skips_pre = false
+ GLI::Commands::Help.skips_post = false
+ GLI::Commands::Help.skips_around = false
+ @command = GLI::Commands::Help.new(TestApp.new,@output,@error)
+ }
+ Then {
+ assert !@command.skips_pre
+ assert !@command.skips_post
+ assert !@command.skips_around
}
end
test_that "invoking help with no arguments results in listing all commands and global options" do
Given a_GLI_app