Sha256: 84bc8285406f1568fecd47f786afd7fc1ed63c94528113c877399e98bef5f57c
Contents?: true
Size: 889 Bytes
Versions: 2
Compression:
Stored size: 889 Bytes
Contents
require 'base_test' require 'optparse_plus' require 'stringio' class TestExitNow < BaseTest include OptparsePlus include OptparsePlus::ExitNow test_that "exit_now raises the proper error" do Given { @exit_code = any_int :min => 1 @message = any_string } When { @code = lambda { exit_now!(@exit_code,@message) } } Then { exception = assert_raises(OptparsePlus::Error,&@code) exception.exit_code.should be == @exit_code exception.message.should be == @message } end test_that "exit_now without an exit code uses 1 as the exti code" do Given { @message = any_string } When { @code = lambda { exit_now!(@message) } } Then { exception = assert_raises(OptparsePlus::Error,&@code) exception.exit_code.should be == 1 exception.message.should be == @message } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
optparse-plus-3.0.1 | test/unit/test_exit_now.rb |
optparse-plus-3.0.0 | test/unit/test_exit_now.rb |