Sha256: 499bc2e4cd68956b3d752082ff8e78bd155841bebf4b125181cf101c984e35a5

Contents?: true

Size: 914 Bytes

Versions: 13

Compression:

Stored size: 914 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 class' do
    expect(warning.smell_category).to eq(detector.smell_category)
  end

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
reek-3.11 spec/reek/smells/smell_detector_shared.rb
reek-3.10.2 spec/reek/smells/smell_detector_shared.rb
reek-3.10.1 spec/reek/smells/smell_detector_shared.rb
reek-3.10.0 spec/reek/smells/smell_detector_shared.rb
reek-3.9.1 spec/reek/smells/smell_detector_shared.rb
reek-3.9.0 spec/reek/smells/smell_detector_shared.rb
reek-3.8.3 spec/reek/smells/smell_detector_shared.rb
reek-3.8.2 spec/reek/smells/smell_detector_shared.rb
reek-3.8.1 spec/reek/smells/smell_detector_shared.rb
reek-3.8.0 spec/reek/smells/smell_detector_shared.rb
reek-3.7.1 spec/reek/smells/smell_detector_shared.rb
reek-3.7.0 spec/reek/smells/smell_detector_shared.rb
reek-3.6.1 spec/reek/smells/smell_detector_shared.rb