Sha256: 8bf0c5540748636f0c076d7dfbd3f45917805ebe7aab3d9b5e97dc8e9260f0b0

Contents?: true

Size: 1.21 KB

Versions: 35

Compression:

Stored size: 1.21 KB

Contents

require_relative '../../../spec_helper'
require_lib 'reek/cli/command/report_command'
require_lib 'reek/cli/options'

RSpec.describe Reek::CLI::Command::ReportCommand do
  describe '#execute' do
    let(:options) { Reek::CLI::Options.new [] }

    let(:configuration) { instance_double 'Reek::Configuration::AppConfiguration' }
    let(:sources) { [source_file] }

    let(:command) do
      described_class.new(options: options,
                          sources: sources,
                          configuration: configuration)
    end

    before do
      allow(configuration).to receive(:directive_for).and_return({})
    end

    context 'when no smells are found' do
      let(:source_file) { CLEAN_FILE }

      it 'returns a success code' do
        result = Reek::CLI::Silencer.silently do
          command.execute
        end
        expect(result).to eq Reek::CLI::Status::DEFAULT_SUCCESS_EXIT_CODE
      end
    end

    context 'when smells are found' do
      let(:source_file) { SMELLY_FILE }

      it 'returns a failure code' do
        result = Reek::CLI::Silencer.silently do
          command.execute
        end
        expect(result).to eq Reek::CLI::Status::DEFAULT_FAILURE_EXIT_CODE
      end
    end
  end
end

Version data entries

35 entries across 33 versions & 2 rubygems

Version Path
reek-6.0.3 spec/reek/cli/command/report_command_spec.rb
reek-6.0.2 spec/reek/cli/command/report_command_spec.rb
reek-6.0.1 spec/reek/cli/command/report_command_spec.rb
reek-6.0.0 spec/reek/cli/command/report_command_spec.rb
reek-5.6.0 spec/reek/cli/command/report_command_spec.rb
reek-5.5.0 spec/reek/cli/command/report_command_spec.rb
reek-5.4.1 spec/reek/cli/command/report_command_spec.rb
reek-5.4.0 spec/reek/cli/command/report_command_spec.rb
reek-5.3.2 spec/reek/cli/command/report_command_spec.rb
reek-5.3.1 spec/reek/cli/command/report_command_spec.rb
reek-5.3.0 spec/reek/cli/command/report_command_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/command/report_command_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/command/report_command_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/command/report_command_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/spec/reek/cli/command/report_command_spec.rb
reek-5.2.0 spec/reek/cli/command/report_command_spec.rb
reek-5.1.0 spec/reek/cli/command/report_command_spec.rb
reek-5.0.2 spec/reek/cli/command/report_command_spec.rb
reek-5.0.1 spec/reek/cli/command/report_command_spec.rb
reek-5.0.0 spec/reek/cli/command/report_command_spec.rb