Sha256: 53b5fd122bebc59f74f20c6a0b5c9dd513358a044b71d6869783d78d589c4248

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe TrailingWhitespace do
        subject(:cop) { described_class.new }

        it 'registers an offence for a line ending with space' do
          source = ['x = 0 ']
          inspect_source(cop, source)
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for a line ending with tab' do
          inspect_source(cop, ["x = 0\t"])
          expect(cop.offences.size).to eq(1)
        end

        it 'accepts a line without trailing whitespace' do
          inspect_source(cop, ["x = 0\n"])
          expect(cop.offences).to be_empty
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/style/trailing_whitespace_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/trailing_whitespace_spec.rb