fix crashes on ruby 2.2
Change-Id: Iae9c3ec3a9415ea163915b1bf6f07d1aaa109d76 Reviewed-on: https://gerrit.instructure.com/56143 Tested-by: Cody Cutrer <cody@instructure.com> Reviewed-by: Rob Orton <rob@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
b941e61993
commit
fad8315d52
|
@ -1,12 +1,11 @@
|
|||
module Marshal
|
||||
class << self
|
||||
alias load_without_retry load
|
||||
module CanvasExt
|
||||
module Marshal
|
||||
# load the class if Rails has not loaded it yet
|
||||
def load(*args)
|
||||
viewed_class_names = []
|
||||
|
||||
begin
|
||||
Marshal.load_without_retry(*args)
|
||||
super
|
||||
rescue ArgumentError => e
|
||||
if e.message =~ /undefined class\/module (.+)/
|
||||
class_name = $1
|
||||
|
@ -16,12 +15,14 @@ module Marshal
|
|||
begin
|
||||
retry if class_name.constantize
|
||||
rescue
|
||||
raise(e)
|
||||
raise
|
||||
end
|
||||
else
|
||||
raise(e)
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Marshal.singleton_class.prepend(CanvasExt::Marshal)
|
||||
|
|
|
@ -147,7 +147,7 @@ describe 'simply_versioned' do
|
|||
describe '.versionable_type' do
|
||||
it 'returns the correct representation of a quiz submission' do
|
||||
submission = quiz_model.quiz_submissions.create
|
||||
submission.with_versioning(explicit: true, &:save!)
|
||||
submission.with_versioning(explicit: true) { submission.save! }
|
||||
version = Version.where(:versionable_id => submission.id, :versionable_type => 'Quizzes::QuizSubmission').first
|
||||
expect(version).not_to be_nil
|
||||
|
||||
|
@ -157,7 +157,7 @@ describe 'simply_versioned' do
|
|||
|
||||
it 'returns the correct representation of a quiz' do
|
||||
quiz = quiz_model
|
||||
quiz.with_versioning(explicit: true, &:save!)
|
||||
quiz.with_versioning(explicit: true) { quiz.save! }
|
||||
version = Version.where(:versionable_id => quiz.id, :versionable_type => 'Quizzes::Quiz').first
|
||||
|
||||
version.versionable_type = 'Quiz'
|
||||
|
@ -167,7 +167,7 @@ describe 'simply_versioned' do
|
|||
|
||||
it 'returns the versionable type attribute if not a quiz' do
|
||||
assignment = assignment_model
|
||||
assignment.with_versioning(explicit: true, &:save!)
|
||||
assignment.with_versioning(explicit: true) { assignment.save! }
|
||||
assignment.versions.each do |version|
|
||||
expect(version.versionable_type).to eq 'Assignment'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue