Sha256: 7c33298abaff3824dad81434f1b473409ef9acfc05f7ce93470ee1fab7676eb8

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require "./test/helper"

clean_describe "help" do
  subject { run_cmd("help") }
  let(:content) { nil }

  describe "with no subcommand passed" do
    it "prints overall help message" do
      value(subject[:stderr]).must_equal ""
      value(subject[:status]).must_equal 0
      value(
        [
          "NAME",
          "SYNOPSIS",
          "VERSION",
          "GLOBAL OPTIONS",
          "COMMANDS"
        ].all? { |msg| subject[:stdout].include? msg }
      ).must_equal true
    end
  end

  describe "with a subcommand passed" do
    subject { run_cmd("help graph") }

    it "prints subcommand help message" do
      value(subject[:stderr]).must_equal ""
      value(subject[:status]).must_equal 0
      value(
        [
          "NAME",
          "SYNOPSIS",
          "COMMAND OPTIONS"
        ].all? { |msg| subject[:stdout].include? msg }
      ).must_equal true
    end
  end

  describe "with an invalid subcommand passed" do
    subject { run_cmd("help garbage") }

    # FIXME: uncomment!!!
    # Waiting for: https://github.com/davetron5000/gli/issues/255
    # it "prints an error message" do
    #   stderr_only "error: Unknown command 'garbage'.  Use 'friends help' for a list of commands."
    # end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
friends-0.55 test/commands/help_spec.rb
friends-0.54 test/commands/help_spec.rb
friends-0.53 test/commands/help_spec.rb
friends-0.52 test/commands/help_spec.rb
friends-0.51 test/commands/help_spec.rb
friends-0.50 test/commands/help_spec.rb
friends-0.49 test/commands/help_spec.rb
friends-0.48 test/commands/help_spec.rb
friends-0.47 test/commands/help_spec.rb