1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
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
Version: #{Spring::VERSION}
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
|