Sha256: 9d1cefbba4e67ab172c69c7f27e4b933b0772430a936ae40f00639e82a440ff6
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 KB
Contents
require 'helper' describe Scide::Opts do before :each do @opts = Scide::Opts.new end it "should add the help flag" do [ '-h', '--help' ].each do |flag| lambda{ parse!([flag]) }.should raise_error(SystemExit){ |err| err.status.should == 0 } end end it "should add the usage flag" do [ '-u', '--usage' ].each do |flag| lambda{ parse!([flag]) }.should raise_error(SystemExit){ |err| err.status.should == 0 } end end it "should add the version flag" do expected_version = File.open(File.join(File.dirname(__FILE__), '..', 'VERSION'), 'r').read lambda{ parse!([ '--version' ]) }.should raise_error(SystemExit){ |err| err.status.should == 0 } end it "should add the dry run flag" do parse!([ '--dry-run' ]) @opts.funnel[:'dry-run'].should == true end it "should exit with status 2 for unknown arguments" do [ '-x', '--fubar', '-4' ].each do |unknown| lambda{ parse!([unknown]) }.should raise_error(SystemExit){ |err| err.status.should == 2 } end end private def parse! args silence_stream(STDOUT){ silence_stream(STDERR){ @opts.parse! args } } end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
scide-0.0.12 | spec/opts_spec.rb |
scide-0.0.11 | spec/opts_spec.rb |
scide-0.0.10 | spec/opts_spec.rb |
scide-0.0.9 | spec/opts_spec.rb |
scide-0.0.8 | spec/opts_spec.rb |
scide-0.0.7 | spec/opts_spec.rb |