Skip to content

Commit

Permalink
Add stupid spec to test help options
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Jun 3, 2008
1 parent fb7b2d0 commit 90f3814
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -223,5 +223,5 @@ def logger

if __FILE__ == $0
$the_app = Yikes.instance
$the_app.run
$the_app.run(ARGV)
end
14 changes: 14 additions & 0 deletions spec/main_spec.rb
Original file line number Diff line number Diff line change
@@ -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.