Sha256: 64b2cd854670ed34662ec8179a4d5bfe0e6a6be51327623f855ff45b17b8d6c2
Contents?: true
Size: 951 Bytes
Versions: 1
Compression:
Stored size: 951 Bytes
Contents
require 'commander' require 'stringio' # Mock terminal IO streams so we can spec against them def mock_terminal @input = StringIO.new @output = StringIO.new $terminal = HighLine.new @input, @output end # Create test command for usage within several specs def create_test_command command :test do |c| c.syntax = "test [options] <file>" c.description = "test description" c.example "description", "command" c.example "description 2", "command 2" c.option "-t", "--trace", "trace description" c.option "--verbose", "verbose description" c.when_called do |args, options| "test %s" % args.join end end @command = command :test end # Create a new global command runner def new_command_runner *args, &block $command_runner = Commander::Runner.new args program :name, 'test' program :version, '1.2.3' program :description, 'something' create_test_command yield if block command_runner end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
visionmedia-commander-3.0.3 | spec/spec_helper.rb |