Sha256: c8b76712546e68e51ab48eff6bd4b6d119b03a32ee1829b9aefacf980c8830d3
Contents?: true
Size: 1.33 KB
Versions: 10
Compression:
Stored size: 1.33 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(:reporter) { double 'reporter' } let(:configuration) { double 'configuration' } let(:sources) { [source_file] } let(:clean_file) { Pathname.glob("#{SAMPLES_PATH}/three_clean_files/*.rb").first } let(:smelly_file) { Pathname.glob("#{SAMPLES_PATH}/two_smelly_files/*.rb").first } 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 = command.execute expect(result).to eq Reek::CLI::Options::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::Options::DEFAULT_FAILURE_EXIT_CODE end end end end
Version data entries
10 entries across 10 versions & 1 rubygems