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

describe Oxidized::CLI do
  before { @original = ARGV }
  after  { ARGV.replace @original }

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

      it 'prints the version and exits' do
        Oxidized::Config.expects(:load)
        Oxidized.expects(:setup_logger)
        File.expects(:expand_path)
        Kernel.expects(:exit)

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