Sha256: aa4dce166bdd09abe69f0d42e9e012d6fa9534320c0a0f8eec2de0dacdb87763
Contents?: true
Size: 998 Bytes
Versions: 7
Compression:
Stored size: 998 Bytes
Contents
require 'spec_helper' module Alf module Operator describe Signature, '#option_parser' do let(:clazz){ Class.new(Object) } let(:signature){ Signature.new(clazz) do |s| s.option :allbut, Boolean, true s.option :name, AttrName, :autonum end } let(:receiver){ clazz.new } before{ signature.install } subject{ signature.option_parser(receiver) } specify "expected" do opt = OptionParser.new opt.on("--allbut"){ receiver.send(:allbut=,true) } opt.on("--name=NAME"){|val| receiver.send(:name=,val) } opt.parse!(["--allbut","--name=world"]) receiver.allbut.should be_true receiver.name.should eq(:world) end it { should be_a(OptionParser) } it "should install option values correctly" do subject.parse!(["--allbut","--name=world"]) receiver.allbut.should be_true receiver.name.should eq(:world) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems