diff --git a/app/models/importers/assignment_importer.rb b/app/models/importers/assignment_importer.rb index c4c0ea03734b5..875d9bf7b3589 100644 --- a/app/models/importers/assignment_importer.rb +++ b/app/models/importers/assignment_importer.rb @@ -126,7 +126,7 @@ def self.import_from_migration(hash, context, migration, item = nil, quiz = nil) if new_record || item.deleted? || master_migration restore_lti_models(item) if item.deleted? item.workflow_state = if item.can_unpublish? - hash[:workflow_state] || "published" + hash[:workflow_state] || "unpublished" else "published" end diff --git a/spec/models/content_migration/course_copy_assignments_spec.rb b/spec/models/content_migration/course_copy_assignments_spec.rb index 2080c00df7d3a..a6324440a5fd9 100644 --- a/spec/models/content_migration/course_copy_assignments_spec.rb +++ b/spec/models/content_migration/course_copy_assignments_spec.rb @@ -83,6 +83,17 @@ end end + it "copies assignments as unpublished" do + from_assign = @copy_from.assignments.create!(title: "published assignment") + from_assign.publish! + expect(from_assign).to be_published + + run_course_copy + + to_assign = @copy_to.assignments.where(migration_id: mig_id(from_assign)).first! + expect(to_assign).to be_unpublished + end + it "links assignments to account rubrics and outcomes" do account = @copy_from.account lo = create_outcome(account)