Sha256: 4a785da1244f48ed6617ec76d8d0e8b80117770cb04379099d9458fe633651cc

Contents?: true

Size: 939 Bytes

Versions: 4

Compression:

Stored size: 939 Bytes

Contents

require_relative '../../spec_helper'
require_lib 'reek/cli/application'

RSpec.describe Reek::CLI::Application do
  describe '#initialize' do
    it 'exits with default error code on invalid options' do
      call = lambda do
        Reek::CLI::Silencer.silently do
          Reek::CLI::Application.new ['--foo']
        end
      end
      expect(call).to raise_error(SystemExit) do |error|
        expect(error.status).to eq Reek::CLI::Options::DEFAULT_ERROR_EXIT_CODE
      end
    end
  end

  context 'report_command' do
    describe '#execute' do
      let(:command) { double 'reek_command' }
      let(:app) { Reek::CLI::Application.new [] }

      before do
        allow(Reek::CLI::Command::ReportCommand).to receive(:new).and_return command
      end

      it "returns the command's result code" do
        allow(command).to receive(:execute).and_return 'foo'
        expect(app.execute).to eq 'foo'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reek-4.0.1 spec/reek/cli/application_spec.rb
reek-4.0.0 spec/reek/cli/application_spec.rb
reek-4.0.0.pre1 spec/reek/cli/application_spec.rb
reek-3.11 spec/reek/cli/application_spec.rb