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

describe Oxidized::CLI do
  let(:asetus) { mock() }

  after  { ARGV.replace @original }
  before { @original = ARGV }

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

      it 'prints the version and exits' do
        Oxidized::Config.expects(:load).returns(asetus)
        Kernel.expects(:exit)

        proc {
          Oxidized::CLI.new
        }.must_output "#{Oxidized::VERSION}\n"
      end
    end
  end
end