Sha256: a0a9e70080734b7d8979218661be7576b77afd445192000a432722a83e59735f

Contents?: true

Size: 694 Bytes

Versions: 13

Compression:

Stored size: 694 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('file.rb', source, nil, nil)
        expect(tws.offences.size).to eq(1)
      end

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rubocop-0.7.2 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.7.1 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.7.0 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.6.1 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.6.0 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.5.0 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.6 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.5 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.4 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.3 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.2 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.1 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.4.0 spec/rubocop/cops/trailing_whitespace_spec.rb