don't error on course export if the course name is too long
test plan: * make a course with a name as long as you can (255 characters) * confirm that you can export it successfully fixes #CNVS-3549 Change-Id: I34dc93ba4578bf67b7155138beee231adeb5d4ef Reviewed-on: https://gerrit.instructure.com/17376 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
parent
ca5c8a8776
commit
9cc01263ff
|
@ -98,7 +98,11 @@ class Wiki < ActiveRecord::Base
|
|||
# TODO i18n
|
||||
t :default_course_wiki_name, "%{course_name} Wiki", :course_name => nil
|
||||
t :default_group_wiki_name, "%{group_name} Wiki", :group_name => nil
|
||||
context.wiki = wiki = Wiki.create!(:title => "#{context.name} Wiki")
|
||||
|
||||
self.extend TextHelper
|
||||
name = truncate_text(context.name, {:max_length => 200, :ellipsis => ''})
|
||||
|
||||
context.wiki = wiki = Wiki.create!(:title => "#{name} Wiki")
|
||||
context.save!
|
||||
wiki
|
||||
end
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#
|
||||
module CC
|
||||
class CCExporter
|
||||
include TextHelper
|
||||
|
||||
ZIP_DIR = 'zip_dir'
|
||||
|
||||
attr_accessor :course, :user, :export_dir, :manifest, :zip_file, :for_course_copy
|
||||
|
@ -134,10 +136,11 @@ module CC
|
|||
end
|
||||
|
||||
def create_zip_file
|
||||
name = truncate_text(@course.name.to_url, {:max_length => 200, :ellipsis => ''})
|
||||
if @qti_only_export
|
||||
@zip_name = "#{@course.name.to_url}-quiz-export.zip"
|
||||
@zip_name = "#{name}-quiz-export.zip"
|
||||
else
|
||||
@zip_name = "#{@course.name.to_url}-export.#{CCHelper::CC_EXTENSION}"
|
||||
@zip_name = "#{name}-export.#{CCHelper::CC_EXTENSION}"
|
||||
end
|
||||
FileUtils::mkdir_p File.join(@export_dir, ZIP_DIR)
|
||||
@zip_path = File.join(@export_dir, ZIP_DIR, @zip_name)
|
||||
|
|
|
@ -397,5 +397,11 @@ describe "Common Cartridge exporting" do
|
|||
@manifest_doc.at_css('resource[href="course_settings/canvas_export.txt"]').should_not be_nil
|
||||
@zip_file.find_entry('course_settings/canvas_export.txt').should_not be_nil
|
||||
end
|
||||
|
||||
it "should not error if the course name is too long" do
|
||||
@course.name = "a" * Course.maximum_string_length
|
||||
|
||||
run_export
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue