Sha256: 17acd3d5dc65f46546c3d878befc735296979b374157f4a35d1f3c2292920443

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

require 'helper'

require "spring/client/command"
require 'spring/client/help'
require 'spring/client'

class HelpTest < ActiveSupport::TestCase
  def spring_commands
    {
      'command' => Class.new {
        def self.description
          'Random Spring Command'
        end
      },
      'rails' => Class.new {
        def self.description
          "omg"
        end
      }
    }
  end

  def application_commands
    {
      'random' => Class.new {
        def description
          'Random Application Command'
        end
      }.new,
      'hidden' => Class.new {
        def description
          nil
        end
      }.new
    }
  end

  def setup
    @help = Spring::Client::Help.new('help', spring_commands, application_commands)
  end

  test "formatted_help generates expected output" do
    expected_output = <<-EOF
Usage: spring COMMAND [ARGS]

Commands for spring itself:

  command  Random Spring Command

Commands for your application:

  rails    omg
  random   Random Application Command
    EOF

    assert_equal expected_output.chomp, @help.formatted_help
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spring-0.0.11 test/unit/client/help_test.rb
spring-0.0.10 test/unit/client/help_test.rb
spring-0.0.9 test/unit/client/help_test.rb
spring-0.0.8 test/unit/client/help_test.rb