Sha256: 5746edac1b0714855b19297d2440bd3001c1fd3c3b1cb3c3c0198b6dff15d079

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

require_relative '../../spec_helper'
require_lib 'reek/report/location_formatter'

RSpec.describe Reek::Report::BlankLocationFormatter do
  let(:warning) { build_smell_warning(lines: [11, 9, 250, 100]) }

  describe '.format' do
    it 'returns a blank String regardless of the warning' do
      expect(described_class.format(warning)).to eq('')
    end
  end
end

RSpec.describe Reek::Report::DefaultLocationFormatter do
  let(:warning) { build_smell_warning(lines: [11, 9, 250, 100]) }

  describe '.format' do
    it 'returns a prefix with sorted line numbers' do
      expect(described_class.format(warning)).to eq('[9, 11, 100, 250]:')
    end
  end
end

RSpec.describe Reek::Report::SingleLineLocationFormatter do
  let(:warning) { build_smell_warning(lines: [11, 9, 250, 100]) }

  describe '.format' do
    it 'returns the first line where the smell was found' do
      expect(described_class.format(warning)).to eq('dummy_file:9: ')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-6.0.3 spec/reek/report/location_formatter_spec.rb
reek-6.0.2 spec/reek/report/location_formatter_spec.rb
reek-6.0.1 spec/reek/report/location_formatter_spec.rb