Sha256: 127d68b63568396df9479e0951731424c3f9b70975d5560c9c959ad0204796a0
Contents?: true
Size: 1007 Bytes
Versions: 2
Compression:
Stored size: 1007 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Rubocop::Cop::Lint::DeprecatedClassMethods do subject(:cop) { described_class.new } it 'registers an offense for File.exists?' do inspect_source(cop, ['File.exists?(o)']) expect(cop.offenses.size).to eq(1) expect(cop.messages) .to eq(['File.exists? is deprecated in favor of File.exist?.']) end it 'registers an offense for Dir.exists?' do inspect_source(cop, ['Dir.exists?(o)']) expect(cop.offenses.size).to eq(1) expect(cop.messages) .to eq(['Dir.exists? is deprecated in favor of Dir.exist?.']) end it 'auto-corrects File.exists? with File.exist?' do new_source = autocorrect_source(cop, 'File.exists?(something)') expect(new_source).to eq('File.exist?(something)') end it 'auto-corrects Dir.exists? with Dir.exist?' do new_source = autocorrect_source(cop, 'Dir.exists?(something)') expect(new_source).to eq('Dir.exist?(something)') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.19.1 | spec/rubocop/cop/lint/deprecated_class_methods_spec.rb |
rubocop-0.19.0 | spec/rubocop/cop/lint/deprecated_class_methods_spec.rb |