Sha256: 273a65e5f251bef8dd74dc984dce4f3d5884f902123cb7c4ea0ff894a0ed5f0b
Contents?: true
Size: 1.18 KB
Versions: 13
Compression:
Stored size: 1.18 KB
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 ::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
13 entries across 13 versions & 2 rubygems