Sha256: 47a491c87492d24418f4b08ab516f9f2815ed8e4328f8cf4d7026f7bcf18b330

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe Attr do
        subject(:cop) { described_class.new }

        it 'registers an offence attr' do
          inspect_source(cop, ['class SomeClass',
                               '  attr :name',
                               'end'])
          expect(cop.offences.size).to eq(1)
        end

        it 'auto-corrects attr to attr_reader' do
          new_source = autocorrect_source(cop, 'attr')
          expect(new_source).to eq('attr_reader')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/style/attr_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/attr_spec.rb