Sha256: 995f71503453b9d7247a1d016a4e287b3f5686489997b8b216ece9b3cf317bf4

Contents?: true

Size: 948 Bytes

Versions: 2

Compression:

Stored size: 948 Bytes

Contents

require_relative '../../spec_helper'
require_relative '../../../lib/reek/configuration/excluded_paths'

RSpec.describe Reek::Configuration::ExcludedPaths do
  describe '#add' do
    subject { [].extend(described_class) }

    context 'one of the given paths does not exist' do
      let(:bogus_path) { Pathname('does/not/exist') }
      let(:paths) { [SAMPLES_PATH, bogus_path] }

      it 'raises an error' do
        Reek::CLI::Silencer.silently(stderr: true) do
          expect { subject.add(paths) }.to raise_error(SystemExit)
        end
      end
    end

    context 'one of given paths is a file' do
      let(:file_as_path) { SAMPLES_PATH.join('inline.rb') }
      let(:paths) { [SAMPLES_PATH, file_as_path] }

      it 'raises an error if one of the given paths is a file' do
        Reek::CLI::Silencer.silently(stderr: true) do
          expect { subject.add(paths) }.to raise_error(SystemExit)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-3.3.1 spec/reek/configuration/excluded_paths_spec.rb
reek-3.3.0 spec/reek/configuration/excluded_paths_spec.rb