diff --git a/lib/inferno/apps/cli/main.rb b/lib/inferno/apps/cli/main.rb index ff2a45aea..a09477309 100644 --- a/lib/inferno/apps/cli/main.rb +++ b/lib/inferno/apps/cli/main.rb @@ -4,6 +4,7 @@ require_relative 'suite' require_relative 'suites' require_relative 'new' +require_relative '../../version' module Inferno module CLI @@ -52,6 +53,11 @@ def suites subcommand 'suite', Suite register(New, 'new', 'new TEST_KIT_NAME', 'Run `inferno new --help` for full help') + + desc 'version', "Output Inferno core version (#{Inferno::VERSION})" + def version + puts "Inferno Core v#{Inferno::VERSION}" + end end end end diff --git a/lib/inferno/apps/cli/main_spec.rb b/lib/inferno/apps/cli/main_spec.rb new file mode 100644 index 000000000..234d49f51 --- /dev/null +++ b/lib/inferno/apps/cli/main_spec.rb @@ -0,0 +1,12 @@ +require 'rspec' +require 'thor' +require 'inferno/apps/cli/main' +require 'inferno/version' + +RSpec.describe Inferno::CLI::Main do # rubocop:disable RSpec/FilePath + context 'with version command' do + it 'outputs current Inferno version' do + expect { described_class.new.version }.to output("#{Inferno::VERSION}\n").to_stdout + end + end +end