Sha256: 6f48cf8df4fe70b8c7cd1124403dd095364137f95ec3b9ba10ce6f9fa2b36f90

Contents?: true

Size: 682 Bytes

Versions: 5

Compression:

Stored size: 682 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)
        tws.offences.size.should == 1
      end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.3.2 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.3.1 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.3.0 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.2.1 spec/rubocop/cops/trailing_whitespace_spec.rb
rubocop-0.2.0 spec/rubocop/cops/trailing_whitespace_spec.rb