Sha256: 4cb352ae1db911f2aff87d179f98f7a037236aed415418dc29f00d9a946e43b5

Contents?: true

Size: 1.93 KB

Versions: 2

Compression:

Stored size: 1.93 KB

Contents

# encoding: utf-8
# rubocop:disable LineLength

require 'spec_helper'

module Rubocop
  module Cop
    module Lint
      describe EndAlignment do
        subject(:cop) { EndAlignment.new }

        it 'registers an offence for mismatched class end' do
          inspect_source(cop,
                         ['class Test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for mismatched module end' do
          inspect_source(cop,
                         ['module Test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for mismatched def end' do
          inspect_source(cop,
                         ['def test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for mismatched defs end' do
          inspect_source(cop,
                         ['def Test.test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for mismatched if end' do
          inspect_source(cop,
                         ['if test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for mismatched while end' do
          inspect_source(cop,
                         ['while test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end

        it 'registers an offence for mismatched until end' do
          inspect_source(cop,
                         ['until test',
                          '  end'
                         ])
          expect(cop.offences.size).to eq(1)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/lint/end_alignment_spec.rb
rubocop-0.13.0 spec/rubocop/cop/lint/end_alignment_spec.rb