From c87397517a6ebb4ab66ecbebbb4624cf12dc3546 Mon Sep 17 00:00:00 2001 From: Derek DeVries Date: Wed, 5 Feb 2014 16:18:41 -0700 Subject: [PATCH] fix failing spec on quiz fixed: - since we're not explicitly checking for errors in quiz_submission#save, throw an exception if an error happens. - fix error formatting assertion Change-Id: I1ac2134a965d329e733c8f54ed2786e06adff91e Reviewed-on: https://gerrit.instructure.com/29703 Tested-by: Jenkins Reviewed-by: Cody Cutrer Product-Review: Derek DeVries QA-Review: Derek DeVries --- app/models/quizzes/quiz.rb | 2 +- spec/models/quizzes/quiz_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/quizzes/quiz.rb b/app/models/quizzes/quiz.rb index 742322ab9d8..f67375d81b2 100644 --- a/app/models/quizzes/quiz.rb +++ b/app/models/quizzes/quiz.rb @@ -309,7 +309,7 @@ class Quizzes::Quiz < ActiveRecord::Base # If the quiz suddenly changes from non-graded to graded, # then this will update the existing submissions to reflect quiz # scores in the gradebook. - self.quiz_submissions.each { |s| s.save } + self.quiz_submissions.each { |s| s.save! } end attr_accessor :saved_by diff --git a/spec/models/quizzes/quiz_spec.rb b/spec/models/quizzes/quiz_spec.rb index 4875a5ed1fe..8319ab6846a 100644 --- a/spec/models/quizzes/quiz_spec.rb +++ b/spec/models/quizzes/quiz_spec.rb @@ -972,7 +972,7 @@ describe Quizzes::Quiz do it "should not allow quiz points higher than allowable by postgres" do q = Quizzes::Quiz.new(:points_possible => 2000000001) q.valid?.should == false - q.errors.on(:points_possible).should == "must be less than or equal to 2000000000" + Array(q.errors[:points_possible]).should == ["must be less than or equal to 2000000000"] end end