Sha256: 1bd97836ca5f64a453c975a0fbe16547e5f23008d915170247eeac1097f1c856

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

describe Commander do
	
	before :each do
		init_commander :version => '1.3.2', :name => 'My Program'
		command :test_command do |c|
			c.syntax = 'test_command [options]'
			c.description = 'Just a test command.'
			c.option '-h', '--help', 'View help information.'
			c.option '--version', 'View program version.'
			c.option '-v', '--verbose', 'Verbose output.'
			c.example 'View help', 'test_command --help'
			c.example 'View version', 'test_command --version'
		end
		@manager = Commander::Manager.instance
	end
	
	it "should add commands" do
		@manager.length.should == 1
	end
	
	it "should fetch commands with the #get_command method" do
		get_command(:test_command).syntax.should == 'test_command [options]'
	end
	
	it "should test existance of a command using #command_exists?" do
		command_exists?(:test_command).should == true
		command_exists?(:test).should == false
	end
	
	it "should inialize and set the version" do
		info(:version).should == '1.3.2'
		info(:major).should == 1
		info(:minor).should == 3
		info(:tiny).should == 2
	end
	
	it "should set program name" do
		info(:name).should == 'My Program'
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
visionmedia-commander-1.2.2 spec/commander_spec.rb