lib/serverspec/setup.rb in serverspec-2.42.0 vs lib/serverspec/setup.rb in serverspec-2.42.1
- old
+ new
@@ -125,11 +125,11 @@
describe port(80) do
it { should be_listening }
end
EOF
- if File.exists? "spec/#{@hostname}/sample_spec.rb"
+ if File.exist? "spec/#{@hostname}/sample_spec.rb"
old_content = File.read("spec/#{@hostname}/sample_spec.rb")
if old_content != content
$stderr.puts "!! spec/#{@hostname}/sample_spec.rb already exists and differs from template"
end
else
@@ -139,11 +139,11 @@
puts " + spec/#{@hostname}/sample_spec.rb"
end
end
def self.safe_mkdir(dir)
- if File.exists? dir
+ if File.exist? dir
unless File.directory? dir
$stderr.puts "!! #{dir} already exists and is not a directory"
end
else
FileUtils.mkdir dir
@@ -151,11 +151,11 @@
end
end
def self.safe_create_spec_helper
content = ERB.new(spec_helper_template, nil, '-').result(binding)
- if File.exists? 'spec/spec_helper.rb'
+ if File.exist? 'spec/spec_helper.rb'
old_content = File.read('spec/spec_helper.rb')
if old_content != content
$stderr.puts "!! spec/spec_helper.rb already exists and differs from template"
end
else
@@ -194,11 +194,11 @@
t.pattern = "spec/#{original_target}/*_spec.rb"
end
end
end
EOF
- if File.exists? 'Rakefile'
+ if File.exist? 'Rakefile'
old_content = File.read('Rakefile')
if old_content != content
$stderr.puts '!! Rakefile already exists and differs from template'
end
else
@@ -210,11 +210,11 @@
end
def self.find_vagrantfile
Pathname.new(Dir.pwd).ascend do |dir|
path = File.expand_path('Vagrantfile', dir)
- return path if File.exists?(path)
+ return path if File.exist?(path)
end
nil
end
def self.auto_vagrant_configuration
@@ -332,10 +332,10 @@
def self.safe_create_dotrspec
content = <<-'EOF'
--color
--format documentation
EOF
- if File.exists? '.rspec'
+ if File.exist? '.rspec'
old_content = File.read('.rspec')
if old_content != content
$stderr.puts '!! .rspec already exists and differs from template'
end
else