cleanup refactor of Rubocop's Lint/DeprecatedClassMethods

fixes: CNVS-20009

This change replaces deprecated methods (like `.exists?`)
with their current counterparts (like `.exist?`)

This cleanup refactor was automatically generated using
this command:

  `rubocop $(find . -name '*.rb') --only Lint/DeprecatedClassMethods --auto-correct`

These code changes were autocorrected then reviewed.

Change-Id: I385dbfc402d94a1f37330293123c6003aaac5b30
Reviewed-on: https://gerrit.instructure.com/52886
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
This commit is contained in:
Strand McCutchen 2015-04-27 09:59:20 -07:00
parent 19271f0521
commit 7f659c2ce7
53 changed files with 80 additions and 80 deletions

View File

@ -48,7 +48,7 @@ module CanvasRails
# Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
config.time_zone = 'UTC'
log_config = File.exists?(Rails.root+"config/logging.yml") && YAML.load_file(Rails.root+"config/logging.yml")[Rails.env]
log_config = File.exist?(Rails.root+"config/logging.yml") && YAML.load_file(Rails.root+"config/logging.yml")[Rails.env]
log_config = { 'logger' => 'rails', 'log_level' => 'debug' }.merge(log_config || {})
opts = {}
require 'canvas_logger'

View File

@ -1,4 +1,4 @@
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

View File

@ -2,14 +2,14 @@
def maintain_client_app_symlinks
# remove bad symlinks first
Dir.glob("public/javascripts/client_apps/*").each do |app_symlink|
if File.symlink?(app_symlink) && !File.exists?(app_symlink)
if File.symlink?(app_symlink) && !File.exist?(app_symlink)
File.unlink(app_symlink)
end
end
# create new ones
Dir.glob("client_apps/*").select { |f| File.directory?(f) }.each do |app_dir|
unless File.exists?("public/javascripts/client_apps")
unless File.exist?("public/javascripts/client_apps")
FileUtils.makedirs("public/javascripts/client_apps")
end
@ -20,7 +20,7 @@ def maintain_client_app_symlinks
target = "../../../#{app_dir}/dist/#{asset}"
unless File.symlink?(source) && File.readlink(source) == target
File.unlink(source) if File.exists?(source)
File.unlink(source) if File.exist?(source)
File.symlink(target, source)
end
end

View File

@ -1,10 +1,10 @@
if Rails.env.development? && ENV["CANVAS_SOURCE_MAPS"] != "0"
app_dir = File.expand_path "#{Rails.root}/public/app"
FileUtils.makedirs(app_dir) unless File.exists?(app_dir)
FileUtils.makedirs(app_dir) unless File.exist?(app_dir)
symlink = File.expand_path "#{Rails.root}/public/app/coffeescripts"
target = File.expand_path "#{Rails.root}/app/coffeescripts"
unless File.symlink?(symlink) && File.readlink(symlink) == target
File.unlink(symlink) if File.exists?(symlink)
File.unlink(symlink) if File.exist?(symlink)
File.symlink(target,symlink)
end
end

View File

@ -3,19 +3,19 @@ def maintain_plugin_symlinks(local_path, plugin_path=nil)
# remove bad symlinks first
Dir.glob("#{local_path}/plugins/*").each do |plugin_dir|
if File.symlink?(plugin_dir) && !File.exists?(plugin_dir)
if File.symlink?(plugin_dir) && !File.exist?(plugin_dir)
File.unlink(plugin_dir)
end
end
# create new ones
Dir.glob("{gems,vendor}/plugins/*/#{plugin_path}").each do |plugin_dir|
FileUtils.makedirs("#{local_path}/plugins") unless File.exists?("#{local_path}/plugins")
FileUtils.makedirs("#{local_path}/plugins") unless File.exist?("#{local_path}/plugins")
plugin = plugin_dir.gsub(%r{^(?:gems|vendor)/plugins/(.*)/#{plugin_path}$}, '\1')
source = "#{local_path}/plugins/#{plugin}"
target = "#{local_path.gsub(%r{[^/]+}, '..')}/../#{plugin_dir}"
unless File.symlink?(source) && File.readlink(source) == target
File.unlink(source) if File.exists?(source)
File.unlink(source) if File.exist?(source)
File.symlink(target, source)
end
end

View File

@ -22,7 +22,7 @@ Rack::MiniProfiler.config.tap do |c|
c.storage = ::Rack::MiniProfiler::RedisStore
elsif Rails.env.development?
tmp = Rails.root.to_s + "/tmp/miniprofiler"
FileUtils.mkdir_p(tmp) unless File.exists?(tmp)
FileUtils.mkdir_p(tmp) unless File.exist?(tmp)
c.storage_options = {
:path => tmp
}

View File

@ -91,9 +91,9 @@ module AttachmentFu # :nodoc:
# the cruft that happens because of this
return
return unless @old_filename && @old_filename != full_filename
if save_attachment? && File.exists?(@old_filename)
if save_attachment? && File.exist?(@old_filename)
FileUtils.rm @old_filename
elsif File.exists?(@old_filename)
elsif File.exist?(@old_filename)
FileUtils.mv @old_filename, full_filename
end
@old_filename = nil

View File

@ -26,7 +26,7 @@ end
describe "execute and update" do
let(:config_path) { File.expand_path("../../../../../config/cassandra.yml", __FILE__) }
let(:cassandra_configured?) do
File.exists?(config_path) &&
File.exist?(config_path) &&
YAML.load(ERB.new(File.read(config_path)).result) &&
YAML.load(ERB.new(File.read(config_path)).result)['test']
end

View File

@ -16,7 +16,7 @@ module QuestionHelpers
def self.fixture(question_type)
path = File.join(FixturePath, "#{question_type}_data.json")
unless File.exists?(path)
unless File.exist?(path)
raise '' <<
"Missing question data fixture for question of type #{question_type}" <<
", expected file to be located at #{path}"

View File

@ -64,7 +64,7 @@ class CanvasUnzip
bytes_left = limits.maximum_bytes
files_left = limits.maximum_files
raise ArgumentError, "File not found" unless File.exists?(archive_filename)
raise ArgumentError, "File not found" unless File.exist?(archive_filename)
raise ArgumentError, "Needs block or destination path" unless dest_folder || block
each_entry(archive_filename) do |entry, index|

View File

@ -54,9 +54,9 @@ describe "CanvasUnzip" do
Dir.mkdir(subdir)
warnings = CanvasUnzip.extract_archive(fixture_filename("evil.#{extension}"), subdir)
expect(warnings[:unsafe].sort).to eq ["../outside.txt", "evil_symlink", "tricky/../../outside.txt"]
expect(File.exists?(File.join(tmpdir, 'outside.txt'))).to be false
expect(File.exists?(File.join(subdir, 'evil_symlink'))).to be false
expect(File.exists?(File.join(subdir, 'inside.txt'))).to be true
expect(File.exist?(File.join(tmpdir, 'outside.txt'))).to be false
expect(File.exist?(File.join(subdir, 'evil_symlink'))).to be false
expect(File.exist?(File.join(subdir, 'inside.txt'))).to be true
end
end

View File

@ -11,7 +11,7 @@ module HandlebarsTasks
dest = parse_dest(path)
precompiled = compile_template(path)
dir = File.dirname(dest)
FileUtils.mkdir_p(dir) unless File.exists?(dir)
FileUtils.mkdir_p(dir) unless File.exist?(dir)
File.open(dest, 'w') { |f| f.write precompiled }
end

View File

@ -49,7 +49,7 @@ module HandlebarsTasks
source = File.read(file)
plugin ||= compiled_path =~ /vendor\/plugins\/([^\/]*)\// ? $1 : nil
js = compile_template(source, file, id, plugin)
FileUtils.mkdir_p(dir) unless File.exists?(dir)
FileUtils.mkdir_p(dir) unless File.exist?(dir)
File.open(path, 'w') { |file| file.write(js) }
end

View File

@ -24,7 +24,7 @@ module Moodle
File.open(@course[:full_export_file_path], 'w') { |file| file << @course.to_json}
@course
ensure
FileUtils.rm migrator.imscc_path if migrator && migrator.imscc_path && File.exists?(migrator.imscc_path)
FileUtils.rm migrator.imscc_path if migrator && migrator.imscc_path && File.exist?(migrator.imscc_path)
end
def add_question_warnings

View File

@ -17,7 +17,7 @@ describe Moodle::Converter do
Importers::CourseContentImporter.import_content(@course, @course_data, nil, @cm)
converter.delete_unzipped_archive
if File.exists?(unzipped_file_path)
if File.exist?(unzipped_file_path)
FileUtils::rm_rf(unzipped_file_path)
end
end

View File

@ -10,7 +10,7 @@ describe Moodle::Converter do
converter.export
@base_course_data = converter.course.with_indifferent_access
converter.delete_unzipped_archive
if File.exists?(unzipped_file_path)
if File.exist?(unzipped_file_path)
FileUtils::rm_rf(unzipped_file_path)
end

View File

@ -7,9 +7,9 @@ module Qti
EXPECTED_LOCATION_ALT = Rails.root.join('vendor', 'qti_migration_tool', PYTHON_MIGRATION_EXECUTABLE).to_s rescue nil
@migration_executable = nil
if File.exists?(EXPECTED_LOCATION)
if File.exist?(EXPECTED_LOCATION)
@migration_executable = EXPECTED_LOCATION
elsif File.exists?(EXPECTED_LOCATION_ALT)
elsif File.exist?(EXPECTED_LOCATION_ALT)
@migration_executable = EXPECTED_LOCATION_ALT
elsif `#{PYTHON_MIGRATION_EXECUTABLE} --version 2>&1` =~ /qti/i
@migration_executable = PYTHON_MIGRATION_EXECUTABLE

View File

@ -45,7 +45,7 @@ class Converter < Canvas::Migration::Migrator
@course[:assessments] = convert_assessments(@course[:assessment_questions][:assessment_questions])
original_manifest_path = File.join(@unzipped_file_path, MANIFEST_FILE)
if File.exists?(original_manifest_path)
if File.exist?(original_manifest_path)
@manifest = Nokogiri::XML(File.open(original_manifest_path))
post_process_assessments # bring in canvas metadata if available
end
@ -63,7 +63,7 @@ class Converter < Canvas::Migration::Migrator
end
def self.is_qti_2(manifest_path)
if File.exists?(manifest_path)
if File.exist?(manifest_path)
xml = Nokogiri::XML(File.open(manifest_path))
if xml.namespaces.values.any? { |v| QTI_2_NAMESPACES.any?{|ns| v.to_s.start_with?(ns)} }
return true

View File

@ -24,7 +24,7 @@ if Qti.migration_executable
after(:all) do
truncate_all_tables
@converter.delete_unzipped_archive
if File.exists?(@dir)
if File.exist?(@dir)
FileUtils::rm_rf(@dir)
end
end

View File

@ -24,7 +24,7 @@ if Qti.migration_executable
end
after :each do
if @export_folder && File.exists?(@export_folder)
if @export_folder && File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
end

View File

@ -8,7 +8,7 @@ describe "QTI 2.1 zip" do
@exporter = Qti::Converter.new(:export_archive_path=>archive_file_path, :base_download_dir=>unzipped_file_path)
@exporter.export
@exporter.delete_unzipped_archive
if File.exists?(export_folder)
if File.exist?(export_folder)
FileUtils::rm_rf(export_folder)
end
end

View File

@ -21,7 +21,7 @@ describe "Converting Blackboard Vista qti" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
end

View File

@ -207,7 +207,7 @@ module Guard
def run_on_deletion(paths)
clean(paths).each do |file|
javascript = file.gsub(/(js\.coffee|coffee)$/, 'js')
File.remove(javascript) if File.exists?(javascript)
File.remove(javascript) if File.exist?(javascript)
end
end
@ -223,7 +223,7 @@ module Guard
def clean(paths)
paths.uniq!
paths.compact!
paths.select { |p| p =~ /.coffee$/ && File.exists?(p) }
paths.select { |p| p =~ /.coffee$/ && File.exist?(p) }
end
end

View File

@ -69,7 +69,7 @@ module Guard
#
def run_all
UI.info "Compiling all handlebars templates in #{@options[:input]} to #{@options[:output]}"
FileUtils.rm_r @options[:output] if File.exists?(@options[:output])
FileUtils.rm_r @options[:output] if File.exist?(@options[:output])
HandlebarsTasks::Handlebars.compile @options[:input], @options[:output]
UI.info "Successfully compiled all handlebars templates in #{@options[:input]}"
end
@ -84,7 +84,7 @@ module Guard
paths.each do |file|
javascript = file.sub(%r{\A#{Regexp.escape(@options[:input])}/(.*?)\.handlebars}, "#{@options[:output]}/\\1.js")
UI.info "Removing: #{javascript}"
File.delete(javascript) if File.exists?(javascript)
File.delete(javascript) if File.exist?(javascript)
end
end

View File

@ -22,7 +22,7 @@ module Canvas::MessageHelper
end
def self.add_message_path(path)
if File.exists?(path) && File.directory?(path)
if File.exist?(path) && File.directory?(path)
@message_paths ||= []
@message_paths << path
end
@ -33,7 +33,7 @@ module Canvas::MessageHelper
if @message_paths
@message_paths.each do |mp|
test_path = File.join(mp, filename)
if File.exists?(test_path)
if File.exist?(test_path)
path = test_path
break
end

View File

@ -21,7 +21,7 @@ module Canvas::Migration
else
unzip_archive
path = File.join(self.unzipped_file_path, entry)
File.exists?(path) && File.read(path)
File.exist?(path) && File.read(path)
end
end
@ -32,7 +32,7 @@ module Canvas::Migration
# if it's not an actual zip file
# just extract the package (or try to) and look for the file
unzip_archive
File.exists?(File.join(self.unzipped_file_path, entry))
File.exist?(File.join(self.unzipped_file_path, entry))
end
end
@ -100,7 +100,7 @@ module Canvas::Migration
end
def delete_unzipped_file
if File.exists?(self.unzipped_file_path)
if File.exist?(self.unzipped_file_path)
FileUtils::rm_rf(self.unzipped_file_path)
end
end

View File

@ -85,7 +85,7 @@ class Migrator
@course[:file_map].each_value do |val|
file_path = File.join(base_dir, val[:real_path] || val[:path_name])
val.delete :real_path
if File.exists?(file_path)
if File.exist?(file_path)
zipfile.add(val[:path_name], file_path)
else
add_warning(I18n.t('canvas.migration.errors.file_does_not_exist', 'The file "%{file_path}" did not exist in the content package and could not be imported.', :file_path => val[:path_name]))
@ -138,7 +138,7 @@ class Migrator
doc = nil
if rel_path
path = get_full_path(rel_path)
if File.exists?(path)
if File.exist?(path)
doc = open_file_xml(path)
end
end

View File

@ -109,7 +109,7 @@ module MigratorHelper
path = create_export_dir(slug)
i = 1
while File.exists?(path) && File.directory?(path)
while File.exist?(path) && File.directory?(path)
i += 1
path = create_export_dir("#{slug}_attempt_#{i}")
end

View File

@ -75,7 +75,7 @@ module Canvas::Migration::Worker
begin
config = ConfigFile.load('external_migration')
if !config || !config[:keep_after_complete]
FileUtils::rm_rf(folder) if File.exists?(folder)
FileUtils::rm_rf(folder) if File.exist?(folder)
end
rescue
Rails.logger.warn "Couldn't clear export data for content_migration #{content_migration.id}"

View File

@ -88,11 +88,11 @@ module XMLHelper
end
def open_file(path)
File.exists?(path) ? ::Nokogiri::HTML(File.open(path)) : nil
File.exist?(path) ? ::Nokogiri::HTML(File.open(path)) : nil
end
def open_file_xml(path)
File.exists?(path) ? create_xml_doc(File.open(path)) : nil
File.exist?(path) ? create_xml_doc(File.open(path)) : nil
end
def create_xml_doc(string_or_io)

View File

@ -52,7 +52,7 @@ module Canvas
def load_config_file(app_name, file_name)
config_file = base_path(app_name, 'dist', "#{app_name}.#{file_name}")
if File.exists?(config_file)
if File.exist?(config_file)
JSON.parse(File.read(config_file))
end
end

View File

@ -62,7 +62,7 @@ module CC
copy_all_to_zip
@zip_file.close
if @content_export && File.exists?(@zip_path)
if @content_export && File.exist?(@zip_path)
att = Attachment.new
att.context = @content_export
att.user = @content_export.user
@ -129,7 +129,7 @@ module CC
@export_dir = File.join(folder, slug)
i = 1
while File.exists?(@export_dir) && File.directory?(@export_dir)
while File.exist?(@export_dir) && File.directory?(@export_dir)
i += 1
@export_dir = File.join(folder, "#{slug}_attempt_#{i}")
end

View File

@ -48,7 +48,7 @@ module CC::Importer
path = res[:href] || (res[:files] && res[:files].first && res[:files].first[:href])
path = converter.get_full_path(path)
if File.exists?(path)
if File.exist?(path)
doc = open_file_xml(path)
tool = convert_blti_link(doc)
tool[:migration_id] = res[:migration_id]

View File

@ -24,7 +24,7 @@ module CC::Importer::Canvas
def settings_doc(file, html = false)
path = File.join(@unzipped_file_path, COURSE_SETTINGS_DIR, file)
return nil unless File.exists? path
return nil unless File.exist? path
if html
open_file path
else

View File

@ -24,7 +24,7 @@ module CC::Importer::Canvas
assessments = []
qti_folder = File.join(@unzipped_file_path, ASSESSMENT_NON_CC_FOLDER)
return unless File.exists?(qti_folder) && File.directory?(qti_folder)
return unless File.exist?(qti_folder) && File.directory?(qti_folder)
run_qti_converter(qti_folder)
@course[:assessment_questions] = convert_questions
@ -37,7 +37,7 @@ module CC::Importer::Canvas
def run_qti_converter(qti_folder)
# convert to 2.1
@dest_dir_2_1 = File.join(qti_folder, "qti_2_1")
return unless File.exists?(qti_folder)
return unless File.exist?(qti_folder)
command = Qti.get_conversion_command(@dest_dir_2_1, qti_folder)
logger.debug "Running migration command: #{command}"

View File

@ -39,7 +39,7 @@ module CC::Importer::Canvas
def convert_file_metadata(file_map)
path = File.join(@unzipped_file_path, COURSE_SETTINGS_DIR, FILES_META)
return unless File.exists? path
return unless File.exist? path
doc = open_file_xml path
if folders = doc.at_css('folders')

View File

@ -38,7 +38,7 @@ module CC::Importer::Standard
File.open(full_path, 'w') {|f| f << qti_node.to_xml} # write to file so we can convert with qti exporter
end
if File.exists?(full_path)
if File.exist?(full_path)
qti_converted_dir = File.join(conversion_dir, id)
if run_qti_converter(full_path, qti_converted_dir, id)
# get quizzes/questions

View File

@ -63,11 +63,11 @@ module CC::Importer::Standard
next if zipfile.entries.include?(val[:path_name])
file_path = File.join(@unzipped_file_path, val[:path_name])
if File.exists?(file_path)
if File.exist?(file_path)
zipfile.add(val[:path_name], file_path) if !File.directory?(file_path)
else
web_file_path = File.join(@unzipped_file_path, WEB_RESOURCES_FOLDER, val[:path_name])
if File.exists?(web_file_path)
if File.exist?(web_file_path)
zipfile.add(val[:path_name], web_file_path) if !File.directory?(web_file_path)
else
val[:errored] = true

View File

@ -23,7 +23,7 @@ module CC::Importer::Standard
url = ''
if resource[:files] && resource[:files].first
path = get_full_path(resource[:files].first[:href])
if File.exists?(path)
if File.exist?(path)
xml = File.open(path).read
# because of some sadness from certain vendors clear empty namespace declarations
xml.gsub!(/xmlns=""/, '')

View File

@ -40,7 +40,7 @@ module ConfigFile
config = nil
path = File.join(Rails.root, 'config', "#{config_name}.yml")
if File.exists?(path)
if File.exist?(path)
config_string = ERB.new(File.read(path))
config = YAML.load(config_string.result)

View File

@ -132,7 +132,7 @@ class CutyCapt
end
if !success
File.unlink(img_file) if File.exists?(img_file)
File.unlink(img_file) if File.exist?(img_file)
return nil
else
logger.info("Capture took #{Time.now.to_i - start.to_i} seconds")
@ -140,7 +140,7 @@ class CutyCapt
if block_given?
yield img_file
File.unlink(img_file) if File.exists?(img_file)
File.unlink(img_file) if File.exist?(img_file)
return nil
end

View File

@ -57,7 +57,7 @@ module DataFixup
end
def self.local_storage_save(rescued_orphan)
if File.exists? rescued_orphan.full_filename
if File.exist? rescued_orphan.full_filename
finalize_attachment(rescued_orphan)
else
rescued_orphan.context_id = @broken_user.id

View File

@ -15,7 +15,7 @@ class EmberBundle
@paths = files.map { |file| parse_require_path(file) }
@objects = files.map { |file| parse_object_name(file) }
@assigns = @objects.map { |object| "#{object}: #{object}" }.join("\n ")
if File.exists?("#{@root}/config/routes.coffee")
if File.exist?("#{@root}/config/routes.coffee")
@routes = "
App.initializer
name: 'routes'

View File

@ -39,7 +39,7 @@ QUESTIONS = [
SYSTEMS = ['vista', 'bb8', 'bb9', 'angel']
def import_data_exists?(sub_folder, hash_name)
File.exists? File.join(IMPORT_JSON_DIR, sub_folder, "#{hash_name}.json")
File.exist? File.join(IMPORT_JSON_DIR, sub_folder, "#{hash_name}.json")
end
def get_import_data(sub_folder, hash_name)

View File

@ -33,7 +33,7 @@ describe "Common Cartridge exporting" do
end
after(:each) do
if @file_handle && File.exists?(@file_handle.path)
if @file_handle && File.exist?(@file_handle.path)
FileUtils::rm_rf(@file_handle.path)
end
end

View File

@ -1330,7 +1330,7 @@ describe "cc assignment extensions" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables
@ -1384,7 +1384,7 @@ describe "matching question reordering" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables

View File

@ -21,7 +21,7 @@ describe "Standard Common Cartridge importing" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables
@ -57,7 +57,7 @@ describe "Standard Common Cartridge importing" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables
@ -122,7 +122,7 @@ describe "Standard Common Cartridge importing" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables
@ -177,7 +177,7 @@ describe "Standard Common Cartridge importing" do
after(:all) do
if @converter
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables

View File

@ -24,7 +24,7 @@ describe "Standard Common Cartridge importing" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables
@ -577,7 +577,7 @@ describe "LTI tool combination" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables
@ -624,7 +624,7 @@ describe "cc assignment extensions" do
after(:all) do
@converter.delete_unzipped_archive
if File.exists?(@export_folder)
if File.exist?(@export_folder)
FileUtils::rm_rf(@export_folder)
end
truncate_all_tables

View File

@ -24,7 +24,7 @@ Dir.glob("../../app/messages/*.erb") do |filename|
filename = File.split(filename)[-1]
event_name = filename.split(".")[0]
event_type = filename.split(".")[1]
if !File.exists?(filename + "_spec.rb")
if !File.exist?(filename + "_spec.rb")
f = File.open(filename + "_spec.rb", 'w')
f.puts sample.gsub(/event_name/, event_name).gsub(/event_type/, event_type)
f.puts "\n\n"

View File

@ -23,7 +23,7 @@ Dir.glob("../../app/messages/*.erb") do |filename|
filename = File.split(filename)[-1]
event_name = filename.split(".")[0]
event_type = filename.split(".")[1]
if File.exists?(filename + "_spec.rb")
if File.exist?(filename + "_spec.rb")
text = File.read(filename + "_spec.rb")
text = text.split("\n\n#")[0]
f = File.open(filename + "_spec.rb", 'w')

View File

@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../helpers/quizzes_common')
describe "canvas_quizzes" do
include_examples "quizzes selenium tests"
USING_NEW_CLIENT_APP = File.exists?(Rails.root.join("client_apps", "canvas_quizzes"))
USING_NEW_CLIENT_APP = File.exist?(Rails.root.join("client_apps", "canvas_quizzes"))
before do
Account.default.tap do |account|

View File

@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/testrail')
config_path=File.expand_path('../../../../config/testrail.yml', __FILE__)
if File.exists?(config_path)
if File.exist?(config_path)
$configuration = YAML.load_file(config_path)
else
$configuration = nil

View File

@ -255,7 +255,7 @@ describe "users" do
f('#teacher_email').send_keys('teacher@example.com')
# if instructure_misc_plugin is installed, number of registration fields increase
if (Dir.exists?('./gems/plugins/instructure_misc_plugin') || Dir.exists?('./vendor/plugins/instructure_misc_plugin'))
if (Dir.exist?('./gems/plugins/instructure_misc_plugin') || Dir.exist?('./vendor/plugins/instructure_misc_plugin'))
set_value f('#teacher_organization_type'), 'Higher Ed'
set_value f('#teacher_school_position'), 'Dean'
f('#teacher_phone').send_keys('1231231234')