fix adding new assignment from modules' add item dialog
When no assignment groups exist yet. Change-Id: I73713f4ccfae9b944b00d0aa1e79af0eeb5d6003 Reviewed-on: https://gerrit.instructure.com/4335 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Zach Wily <zach@instructure.com>
This commit is contained in:
parent
4cfd17d20e
commit
02d8fb212f
|
@ -345,7 +345,7 @@ class AssignmentsController < ApplicationController
|
|||
|
||||
def get_assignment_group(assignment_params)
|
||||
return unless assignment_params
|
||||
if group_id = assignment_params.delete(:assignment_group_id)
|
||||
if (group_id = assignment_params.delete(:assignment_group_id)).present?
|
||||
group = @context.assignment_groups.find(group_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -173,6 +173,14 @@ describe AssignmentsController do
|
|||
assigns[:assignment].title.should eql("some assignment")
|
||||
assigns[:assignment].context_id.should eql(@course.id)
|
||||
end
|
||||
|
||||
it "should create assignment when no groups exist yet" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
post 'create', :course_id => @course.id, :assignment => {:title => "some assignment", :assignment_group_id => ''}
|
||||
assigns[:assignment].should_not be_nil
|
||||
assigns[:assignment].title.should eql("some assignment")
|
||||
assigns[:assignment].context_id.should eql(@course.id)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET 'edit'" do
|
||||
|
|
Loading…
Reference in New Issue