Sha256: adf1957bd9db4517bbf59c15a2947140e278e5c1468fa95e2ad6a616362f3566

Contents?: true

Size: 802 Bytes

Versions: 17

Compression:

Stored size: 802 Bytes

Contents

require_relative '../../spec_helper'

RSpec.shared_examples_for 'SmellDetector' do
  context 'exception matching follows the context' do
    let(:ctx) { double('context') }

    before { allow(ctx).to receive(:config_for).and_return({}) }

    it 'when false' do
      expect(ctx).to receive(:matches?).at_least(:once).and_return(false)
      expect(detector.exception?(ctx)).to eq(false)
    end

    it 'when true' do
      expect(ctx).to receive(:matches?).at_least(:once).and_return(true)
      expect(detector.exception?(ctx)).to eq(true)
    end
  end
end

RSpec.shared_examples_for 'common fields set correctly' do
  it 'reports the source' do
    expect(warning.source).to eq('string')
  end

  it 'reports the smell type' do
    expect(warning.smell_type).to eq(detector.smell_type)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
reek-4.4.0 spec/reek/smells/smell_detector_shared.rb
reek-4.3.0 spec/reek/smells/smell_detector_shared.rb
reek-4.2.5 spec/reek/smells/smell_detector_shared.rb
reek-4.2.4 spec/reek/smells/smell_detector_shared.rb
reek-4.2.3 spec/reek/smells/smell_detector_shared.rb
reek-4.2.2 spec/reek/smells/smell_detector_shared.rb
reek-4.2.1 spec/reek/smells/smell_detector_shared.rb
reek-4.2.0 spec/reek/smells/smell_detector_shared.rb
reek-4.1.1 spec/reek/smells/smell_detector_shared.rb
reek-4.1.0 spec/reek/smells/smell_detector_shared.rb
reek-4.0.5 spec/reek/smells/smell_detector_shared.rb
reek-4.0.4 spec/reek/smells/smell_detector_shared.rb
reek-4.0.3 spec/reek/smells/smell_detector_shared.rb
reek-4.0.2 spec/reek/smells/smell_detector_shared.rb
reek-4.0.1 spec/reek/smells/smell_detector_shared.rb
reek-4.0.0 spec/reek/smells/smell_detector_shared.rb
reek-4.0.0.pre1 spec/reek/smells/smell_detector_shared.rb