Sha256: ea15a4f41ed306f5367ff42f32674ddd523c11d07a3a4dbe92a066474692d602

Contents?: true

Size: 1.67 KB

Versions: 5

Compression:

Stored size: 1.67 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Commander::HelpFormatter::Terminal do
  
  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
        @global_help.should include('install gem')
      end
      
      it "the summary" do
        @global_help.should 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
        @command_help.should include('install gem')
      end
      
      it "the description" do
        @command_help.should include('Install some gem, blah blah blah')
      end
      
      it "all examples" do
        @command_help.should include('# one')
        @command_help.should include('two')
        @command_help.should include('# three')
        @command_help.should include('four')
      end
      
      it "the syntax" do
        @command_help.should include('foo install gem [options]')
      end
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
commander-4.0.4 spec/help_formatters/terminal_spec.rb
commander-4.0.3 spec/help_formatters/terminal_spec.rb
commander-4.0.2 spec/help_formatters/terminal_spec.rb
commander-4.0.1 spec/help_formatters/terminal_spec.rb
commander-4.0.0 spec/help_formatters/terminal_spec.rb