claim courses with teacher after reset

test plan:
 - have a course with a teacher
 - as a teacher, reset the course's content
 - ensure you can add the course to your favorites
   without having to publish it

fixes CNVS-31356

Change-Id: I8647776d725ba264126b72705e4dd436e2145d66
Reviewed-on: https://gerrit.instructure.com/89189
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
Jeremy Stanley 2016-08-30 13:51:50 -06:00
parent 2d03d083c2
commit 559bde438c
3 changed files with 3 additions and 3 deletions

View File

@ -2766,7 +2766,7 @@ class Course < ActiveRecord::Base
self.attributes.delete_if{|k,v| [:id, :created_at, :updated_at, :syllabus_body, :wiki_id, :default_view, :tab_configuration, :lti_context_id, :workflow_state].include?(k.to_sym) }.each do |key, val|
new_course.write_attribute(key, val)
end
new_course.workflow_state = 'created'
new_course.workflow_state = (self.admins.any? ? 'claimed' : 'created')
# there's a unique constraint on this, so we need to clear it out
self.self_enrollment_code = nil
self.self_enrollment = false

View File

@ -1093,7 +1093,7 @@ describe CoursesController, type: :request do
@course.reload
expect(@course.workflow_state).to eql 'deleted'
new_course = Course.find(json['id'])
expect(new_course.workflow_state).to eql 'created'
expect(new_course.workflow_state).to eql 'claimed'
expect(json['workflow_state']).to eql 'unpublished'
end
end

View File

@ -638,6 +638,7 @@ describe Course do
expect(@course.lti_context_id).not_to be_nil
@new_course.reload
expect(@new_course).to be_created
expect(@new_course.course_sections).not_to be_empty
expect(@new_course.students).to eq [@student]
expect(@new_course.discussion_topics).to be_empty
@ -715,7 +716,6 @@ describe Course do
expect(@course.uuid).not_to eq @new_course.uuid
expect(@course.replacement_course_id).to eq @new_course.id
end
end
context "group_categories" do