Skip to content

Commit

Permalink
test version
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Jun 9, 2015
1 parent 3b21929 commit a8643ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/commands/unipept.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_root_command

run do |opts, _args, cmd|
if opts[:version]
puts File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
puts Unipept::VERSION
else
abort cmd.help
end
Expand Down
3 changes: 1 addition & 2 deletions lib/commands/unipept/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def run
end

def config
@config = Unipept::Configuration.new unless @config
@config
@config ||= Unipept::Configuration.new
end

def set_config(key, value)
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Unipept
VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).chomp
end
7 changes: 7 additions & 0 deletions test/commands/test_unipept.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@ def test_no_valid_subcommand
end
assert(err.include? 'show help for this command')
end

def test_version
out, _err = capture_io_while do
Commands::Unipept.run(%w(-v))
end
assert_equal(VERSION, out.chomp)
end
end
end

0 comments on commit a8643ee

Please sign in to comment.