summaryrefslogtreecommitdiff
path: root/spec/cli_spec.rb
blob: f3e7cb4361a80bc41f8449d2dec05ac60872d177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'spec_helper'
require 'oxidized/cli'

describe Oxidized::CLI do
  before do
    @original = ARGV
    @asetus = Asetus.new
  end
  after  { ARGV.replace @original }

  %w[-v --version].each do |option|
    describe option do
      before { ARGV.replace([option]) }

      it 'prints the version and exits' do
        Asetus.expects(:new).returns(@asetus)
        Kernel.expects(:exit)

        assert_output("#{Oxidized::VERSION}\n") { Oxidized::CLI.new }
      end
    end
  end
end