Sha256: 4469bafa659b84c307b8fc0a9f6409e306b86cd1e8cc1469ad57ca5f4c4ea5e7

Contents?: true

Size: 957 Bytes

Versions: 7

Compression:

Stored size: 957 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

require 'drbqs/command_line/command_line'

describe DRbQS::Command::OptionSetting do
  subject do
    DRbQS::Command::OptionSetting.new('help message', DRbQS::Setting::Base.new)
  end

  it "should set log_level option." do
    subject.define(:log_level => true)
    subject.parse!(['--log-level', 'debug']).should be_empty
    subject.setting.get(:log_level).should == ['debug']
  end

  it "should set daemon option." do
    subject.define(:daemon => true)
    subject.parse!(['--daemon', '/path/to/log', 'other options']).should == ['other options']
    subject.setting.get(:daemon).should == ['/path/to/log']
  end

  it "should set an arbitrary option." do
    subject.define do
      set(:new_opt, '--new-opt NUM', Integer, 'Set the number.')
    end
    subject.parse!(['--new-opt', '123', 'HELLO']).should == ['HELLO']
    subject.setting.get(:new_opt).should == [123]
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
drbqs-0.1.1 spec/command_line/option_setting_spec.rb
drbqs-0.1.0 spec/command_line/option_setting_spec.rb
drbqs-0.0.19 spec/command_line/option_setting_spec.rb
drbqs-0.0.18 spec/command_line/option_setting_spec.rb
drbqs-0.0.17 spec/command_line/option_setting_spec.rb
drbqs-0.0.16 spec/command_line/option_setting_spec.rb
drbqs-0.0.15 spec/command_line/option_setting_spec.rb