Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/coffeelint/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.locate
locations.push(ENV['COFFEELINT_CONFIG']) if ENV['COFFEELINT_CONFIG']
locations.concat(config_files_in_path(ENV['HOME'])) if ENV['HOME']

locations.compact.detect { |file| File.exists?(file) }
locations.compact.detect { |file| File.exist?(file) }
end

# Parses a given JSON file to a Hash.
Expand Down
8 changes: 4 additions & 4 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module CoffeeLint
describe Config do
describe '.locate' do
before(:each) { allow(File).to receive(:exists?) { false } }
before(:each) { allow(File).to receive(:exist?) { false } }

it 'returns nil if no config file could be located' do
expect(Config.locate).to eq(nil)
Expand All @@ -12,7 +12,7 @@ module CoffeeLint
context 'default locations' do
%w(coffeelint.json .coffeelint.json config/coffeelint.json config/.coffeelint.json).each do |config_file|
it "tries to locate #{config_file}" do
allow(File).to receive(:exists?).with(config_file).and_return(true)
allow(File).to receive(:exist?).with(config_file).and_return(true)
expect(Config.locate).to eq(config_file)
end
end
Expand All @@ -22,14 +22,14 @@ module CoffeeLint
it 'tries to locate ENV[\'COFFEELINT_CONFIG\']' do
ENV['COFFEELINT_CONFIG'] = 'coffeelint.json'

allow(File).to receive(:exists?).with('coffeelint.json').and_return(true)
allow(File).to receive(:exist?).with('coffeelint.json').and_return(true)
expect(Config.locate).to eq('coffeelint.json')
end

it 'tries to locate config files in ENV[\'HOME\']' do
ENV['HOME'] = '~/coffeescript'

allow(File).to receive(:exists?).with('~/coffeescript/.coffeelint.json').and_return(true)
allow(File).to receive(:exist?).with('~/coffeescript/.coffeelint.json').and_return(true)
expect(Config.locate).to eq('~/coffeescript/.coffeelint.json')
end
end
Expand Down