Commit 56e8f719 authored by nTraum's avatar nTraum
Browse files

added test for version output

parent 34032cce
......@@ -2,7 +2,7 @@ require 'optparse'
module GitlabIrc
class Cli
def initialize (argv)
def initialize(args)
@options = {}
OptionParser.new do |opts|
......@@ -15,13 +15,11 @@ module GitlabIrc
opts.on('-v', '--version', 'Display program version') do
puts "gitlab-irc #{GitlabIrc::VERSION}"
exit
end
opts.on('-h', '--help', 'Display this screen') do
puts opts
exit
end
end.parse!
end.parse!(args)
end
end
end
\ No newline at end of file
require_relative '../test_helper'
describe Cli do
it 'must have the correct version' do
GitlabIrc::VERSION.must_equal '0.1', 'wrong gem version'
describe 'version flag' do
it 'recognizes the short style switch' do
proc { Cli.new ['-v'] }.must_output /^gitlab-irc \d+(\.\d+)*$/
end
it 'recognizes the long style switch' do
proc { Cli.new ['--version'] }.must_output /^gitlab-irc \d+(\.\d+)*$/
end
end
end
\ No newline at end of file
......@@ -3,6 +3,7 @@ Coveralls.wear!
require 'minitest/autorun'
require 'minitest/pride'
require File.expand_path('../../lib/gitlab-irc.rb', __FILE__)
include GitlabIrc
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment