Sha256: 1a7307b36552020f42fecb707df98d4fcedcab36a726d12bb7d4b26e1541758d

Contents?: true

Size: 1.65 KB

Versions: 12

Compression:

Stored size: 1.65 KB

Contents

require '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

12 entries across 12 versions & 2 rubygems

Version Path
clone-1.0.0.beta2 module/gems/commander-4.1.3/spec/help_formatters/terminal_spec.rb
clone-1.0.0.beta module/gems/commander-4.1.3/spec/help_formatters/terminal_spec.rb
commander-4.1.6 spec/help_formatters/terminal_spec.rb
commander-4.1.5 spec/help_formatters/terminal_spec.rb
commander-4.1.4 spec/help_formatters/terminal_spec.rb
commander-4.1.3 spec/help_formatters/terminal_spec.rb
commander-4.1.2 spec/help_formatters/terminal_spec.rb
commander-4.1.1 spec/help_formatters/terminal_spec.rb
commander-4.1.0 spec/help_formatters/terminal_spec.rb
commander-4.0.7 spec/help_formatters/terminal_spec.rb
commander-4.0.6 spec/help_formatters/terminal_spec.rb
commander-4.0.5 spec/help_formatters/terminal_spec.rb