Sha256: 9820d3598e06b4ee820aee8830135df1aec6cf707d9070e5070983a3e664fb76

Contents?: true

Size: 712 Bytes

Versions: 7

Compression:

Stored size: 712 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rubocop-0.12.0 spec/rubocop/cop/style/trailing_whitespace_spec.rb
rubocop-0.11.1 spec/rubocop/cop/style/trailing_whitespace_spec.rb
rubocop-0.11.0 spec/rubocop/cops/style/trailing_whitespace_spec.rb
rubocop-0.10.0 spec/rubocop/cops/style/trailing_whitespace_spec.rb
rubocop-0.9.1 spec/rubocop/cops/style/trailing_whitespace_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/style/trailing_whitespace_spec.rb
rubocop-0.9.0 spec/rubocop/cops/style/trailing_whitespace_spec.rb