Sha256: 6a9e49eaca76c07f739005cf8b4f704af2d553e202e44445a7d86b0f3463e2e8

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

Stored size: 957 Bytes

Contents

require_relative '../../spec_helper'
require_lib 'reek/report/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

1 entries across 1 versions & 1 rubygems

Version Path
reek-4.4.2 spec/reek/report/location_formatter_spec.rb