Sha256: 33bb2999c8af49159f1f3670a791611e5d311c3c14c2f7a4f4608c6c0fd91ecd

Contents?: true

Size: 887 Bytes

Versions: 34

Compression:

Stored size: 887 Bytes

Contents

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

RSpec.describe 'location formatters' do
  let(:warning) { build(:smell_warning, lines: [11, 9, 250, 100]) }

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

  describe Reek::Report::DefaultLocationFormatter do
    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

  describe Reek::Report::SingleLineLocationFormatter do
    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
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
reek-4.4.1 spec/reek/report/location_formatter_spec.rb
reek-4.4.0 spec/reek/report/location_formatter_spec.rb
reek-4.3.0 spec/reek/report/location_formatter_spec.rb
reek-4.2.5 spec/reek/report/location_formatter_spec.rb
reek-4.2.4 spec/reek/report/location_formatter_spec.rb
reek-4.2.3 spec/reek/report/location_formatter_spec.rb
reek-4.2.2 spec/reek/report/location_formatter_spec.rb
reek-4.2.1 spec/reek/report/location_formatter_spec.rb
reek-4.2.0 spec/reek/report/location_formatter_spec.rb
reek-4.1.1 spec/reek/report/location_formatter_spec.rb
reek-4.1.0 spec/reek/report/location_formatter_spec.rb
reek-4.0.5 spec/reek/report/location_formatter_spec.rb
reek-4.0.4 spec/reek/report/location_formatter_spec.rb
reek-4.0.3 spec/reek/report/location_formatter_spec.rb
reek-4.0.2 spec/reek/report/location_formatter_spec.rb
reek-4.0.1 spec/reek/report/location_formatter_spec.rb
reek-4.0.0 spec/reek/report/location_formatter_spec.rb
reek-4.0.0.pre1 spec/reek/report/location_formatter_spec.rb
reek-3.11 spec/reek/report/location_formatter_spec.rb
reek-3.10.2 spec/reek/report/location_formatter_spec.rb