summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2013-04-20 16:52:10 +0400
committerPeter Zotov <whitequark@whitequark.org>2013-04-20 16:54:46 +0400
commit3a5473aa25d073a828d42ab594026651fec276cf (patch)
treedca261cb4e369176b84e0ac3aba4b1934d96ef53 /test
parentcd1d6adc862f339b7e63382fa813391bcbd30dbf (diff)
downloadslop-3a5473aa25d073a828d42ab594026651fec276cf.tar.gz
Add assert_raises(SystemExit) to prevent test suite from dying when testing --help.
Diffstat (limited to 'test')
-rw-r--r--test/slop_test.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/slop_test.rb b/test/slop_test.rb
index 513a0bf..9707e58 100644
--- a/test/slop_test.rb
+++ b/test/slop_test.rb
@@ -341,13 +341,17 @@ class SlopTest < TestCase
test "printing help with :help => true" do
temp_stdout do |string|
opts = Slop.new(:help => true, :banner => false)
- opts.parse %w( --help )
+ assert_raises SystemExit do
+ opts.parse %w( --help )
+ end
assert_equal " -h, --help Display this help message.\n", string
end
temp_stdout do |string|
opts = Slop.new(:help => true)
- opts.parse %w( --help )
+ assert_raises SystemExit do
+ opts.parse %w( --help )
+ end
assert_equal "Usage: rake_test_loader [options]\n -h, --help Display this help message.\n", string
end
end
@@ -465,8 +469,10 @@ class SlopTest < TestCase
assert_equal %w'--help foo bar', items
items.clear
temp_stdout do
- Slop.parse(%w'--help foo bar', :help => true) do
- run { |o, a| items.concat a }
+ assert_raises SystemExit do
+ Slop.parse(%w'--help foo bar', :help => true) do
+ run { |o, a| items.concat a }
+ end
end
assert_empty items
end