Permalink
Browse files

Add stupid spec to test help options

  • Loading branch information...
1 parent fb7b2d0 commit 90f381422a456e24988c659324a09833c7e7e29e @paulcbetts committed Jun 3, 2008
Showing with 17 additions and 3 deletions.
  1. +3 −3 lib/main.rb
  2. +14 −0 spec/main_spec.rb
View
@@ -114,14 +114,14 @@ def parse(args)
results
end
- def run
+ def run(args)
# Initialize Gettext (root, domain, locale dir, encoding) and set up logging
bindtextdomain(AppConfig::Package, nil, nil, "UTF-8")
self.level = Logger::DEBUG
# Parse arguments
begin
- results = parse(ARGV)
+ results = parse(args)
rescue OptionParser::MissingArgument
puts _('Missing parameter; see --help for more info')
exit
@@ -223,5 +223,5 @@ def logger
if __FILE__ == $0
$the_app = Yikes.instance
- $the_app.run
+ $the_app.run(ARGV)
end
View
@@ -1,2 +1,16 @@
+$:.unshift File.dirname(__FILE__)
+
require 'helper'
require 'lib/main'
+
+describe Yikes do
+ it "should display help options" do
+ output = `ruby #{TestDir}/../lib/main.rb --help`
+
+ # This test is stupid, but is a smoke test
+ output.index("Usage:").should == 0
+ output.index("options:").should >= 0
+ output.index("library").should >= 0
+ output.index("target").should >= 0
+ end
+end

0 comments on commit 90f3814

Please sign in to comment.