Add version CLI option

This commit is contained in:
Thibault Jouan
2015-04-18 17:03:25 +00:00
parent dcc41006d0
commit 71caf160be
4 changed files with 32 additions and 0 deletions

View File

@@ -185,6 +185,21 @@ module Uh
end
end
context 'with version option' do
let(:arguments) { %w[-V] }
it 'prints the version on standard output' do
trap_exit { cli.parse_arguments! }
expect(stdout.string).to eq "#{::Uh::WM::VERSION}\n"
end
it 'exits with a return status of 0' do
expect { cli.parse_arguments! }.to raise_error(SystemExit) do |e|
expect(e.status).to eq 0
end
end
end
context 'with invalid option' do
let(:arguments) { %w[--unknown-option] }