Sha256: a4a09960e71b034d301bd5d766cfb794011b70441bd051f6e3d839eccd1abe1e

Contents?: true

Size: 676 Bytes

Versions: 4

Compression:

Stored size: 676 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe TrailingWhitespace do
      let(:tws) { TrailingWhitespace.new }

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.8.2 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.8.1 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.8.0 spec/rubocop/cops/trailing_whitespace_spec.rb