Sha256: 113243aff5783728eabb6cfc0653232b381648bfa06a12f24daf281a9978cb01

Contents?: true

Size: 468 Bytes

Versions: 6

Compression:

Stored size: 468 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'registers an offense attr' do
    inspect_source(cop, ['class SomeClass',
                         '  attr :name',
                         'end'])
    expect(cop.offenses.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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-0.22.0 spec/rubocop/cop/style/attr_spec.rb
rubocop-0.21.0 spec/rubocop/cop/style/attr_spec.rb
rubocop-0.20.1 spec/rubocop/cop/style/attr_spec.rb
rubocop-0.20.0 spec/rubocop/cop/style/attr_spec.rb
rubocop-0.19.1 spec/rubocop/cop/style/attr_spec.rb
rubocop-0.19.0 spec/rubocop/cop/style/attr_spec.rb