Sha256: 9f39c567b37f6b91e4c4acc88113bd985694f115afa92f8a3760935b910485c7

Contents?: true

Size: 1.67 KB

Versions: 30

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe Commander::HelpFormatter::Terminal do
  include Commander::Methods

  before :each do
    mock_terminal
  end

  describe 'global help' do
    before :each do
      new_command_runner 'help' do
        command :'install gem' do |c|
          c.syntax = 'foo install gem [options]'
          c.summary = 'Install some gem'
        end
      end.run!
      @global_help = @output.string
    end

    describe 'should display' do
      it 'the command name' do
        expect(@global_help).to include('install gem')
      end

      it 'the summary' do
        expect(@global_help).to include('Install some gem')
      end
    end
  end

  describe 'command help' do
    before :each do
      new_command_runner 'help', 'install', 'gem' do
        command :'install gem' do |c|
          c.syntax = 'foo install gem [options]'
          c.summary = 'Install some gem'
          c.description = 'Install some gem, blah blah blah'
          c.example 'one', 'two'
          c.example 'three', 'four'
        end
      end.run!
      @command_help = @output.string
    end

    describe 'should display' do
      it 'the command name' do
        expect(@command_help).to include('install gem')
      end

      it 'the description' do
        expect(@command_help).to include('Install some gem, blah blah blah')
      end

      it 'all examples' do
        expect(@command_help).to include('# one')
        expect(@command_help).to include('two')
        expect(@command_help).to include('# three')
        expect(@command_help).to include('four')
      end

      it 'the syntax' do
        expect(@command_help).to include('foo install gem [options]')
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 4 rubygems

Version Path
commander-openflighthpc-2.0.2 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-2.0.1 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-2.0.0 spec/help_formatters/terminal_spec.rb
commander-4.5.2 spec/help_formatters/terminal_spec.rb
commander-4.5.1 spec/help_formatters/terminal_spec.rb
commander-4.5.0 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-1.2.0 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-1.1.2 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-1.1.1 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-1.1.0 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-1.0.0 spec/help_formatters/terminal_spec.rb
commander-openflighthpc-1.0.0.pre.alpha1 spec/help_formatters/terminal_spec.rb
commander-4.4.7 spec/help_formatters/terminal_spec.rb
murano-cli-commander-4.4.10 spec/help_formatters/terminal_spec.rb
commander-4.4.6 spec/help_formatters/terminal_spec.rb
commander-4.4.5 spec/help_formatters/terminal_spec.rb
commander-4.4.4 spec/help_formatters/terminal_spec.rb
commander-4.4.3 spec/help_formatters/terminal_spec.rb
commander-4.4.2 spec/help_formatters/terminal_spec.rb
commander-4.4.1 spec/help_formatters/terminal_spec.rb