don't use update_without_callbacks cause it's gone in rails 3
Change-Id: I0af3c874c33c993da827ad72ab74731520a87782 Reviewed-on: https://gerrit.instructure.com/30337 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Josh Simpson <jsimpson@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
ed812b9ef6
commit
14bc43d2e4
|
@ -1609,22 +1609,10 @@ describe Attachment do
|
|||
attachment.save
|
||||
attachment.context_type.should == "Quizzes::QuizStatistics"
|
||||
|
||||
attachment.context_type = 'QuizStatistics'
|
||||
attachment.send(:update_without_callbacks)
|
||||
Attachment.where(id: attachment).update_all(context_type: 'QuizStatistics')
|
||||
|
||||
Attachment.find(attachment.id).context_type.should == 'Quizzes::QuizStatistics'
|
||||
end
|
||||
|
||||
it 'returns the context type attribute if not a quiz statistics relation' do
|
||||
attachment = Attachment.create!(context: assignment_model,
|
||||
filename: "foo.txt",
|
||||
uploaded_data: StringIO.new("bar"))
|
||||
|
||||
attachment.context = assignment_model
|
||||
attachment.send(:update_without_callbacks)
|
||||
|
||||
attachment.context_type.should == 'Assignment'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -26,8 +26,7 @@ describe DelayedNotification do
|
|||
|
||||
notification.asset_type.should == 'Quizzes::QuizSubmission'
|
||||
|
||||
notification.asset_type = 'QuizSubmission'
|
||||
notification.send(:update_without_callbacks)
|
||||
DelayedNotification.where(id: notification).update_all(asset_type: 'QuizSubmission')
|
||||
|
||||
DelayedNotification.find(notification.id).asset_type.should == 'Quizzes::QuizSubmission'
|
||||
end
|
||||
|
|
|
@ -61,19 +61,10 @@ describe LearningOutcomeResult do
|
|||
learning_outcome_result.save
|
||||
learning_outcome_result.artifact_type.should == 'Quizzes::QuizSubmission'
|
||||
|
||||
learning_outcome_result.association_type = 'QuizSubmission'
|
||||
learning_outcome_result.send(:update_without_callbacks)
|
||||
LearningOutcomeResult.where(id: learning_outcome_result).update_all(association_type: 'QuizSubmission')
|
||||
|
||||
LearningOutcomeResult.find(learning_outcome_result.id).artifact_type.should == 'Quizzes::QuizSubmission'
|
||||
end
|
||||
|
||||
it 'returns the artifact type attribute if not a quiz submission' do
|
||||
learning_outcome_result = create_learning_outcome_result
|
||||
learning_outcome_result.artifact = assignment_model
|
||||
learning_outcome_result.send(:update_without_callbacks)
|
||||
|
||||
learning_outcome_result.artifact_type.should == 'Assignment'
|
||||
end
|
||||
end
|
||||
|
||||
describe '.associated_asset_type' do
|
||||
|
|
|
@ -178,8 +178,7 @@ describe Message do
|
|||
message.save
|
||||
message.context_type.should == "Quizzes::QuizRegradeRun"
|
||||
|
||||
message.context_type = 'QuizRegradeRun'
|
||||
message.send(:update_without_callbacks)
|
||||
Message.where(id: message).update_all(context_type: 'QuizRegradeRun')
|
||||
|
||||
Message.find(message.id).context_type.should == 'Quizzes::QuizRegradeRun'
|
||||
end
|
||||
|
@ -191,19 +190,10 @@ describe Message do
|
|||
message.save
|
||||
message.context_type.should == 'Quizzes::QuizSubmission'
|
||||
|
||||
message.context_type = 'QuizSubmission'
|
||||
message.send(:update_without_callbacks)
|
||||
Message.where(id: message).update_all(context_type: 'QuizSubmission')
|
||||
|
||||
Message.find(message.id).context_type.should == 'Quizzes::QuizSubmission'
|
||||
end
|
||||
|
||||
it 'returns the context type attribute if not a quiz' do
|
||||
message = message_model
|
||||
message.context = assignment_model
|
||||
message.send(:update_without_callbacks)
|
||||
|
||||
message.context_type.should == 'Assignment'
|
||||
end
|
||||
end
|
||||
|
||||
describe '.asset_context_type' do
|
||||
|
@ -216,8 +206,7 @@ describe Message do
|
|||
message.save
|
||||
message.asset_context_type.should == "Quizzes::QuizRegradeRun"
|
||||
|
||||
message.asset_context_type = 'QuizRegradeRun'
|
||||
message.send(:update_without_callbacks)
|
||||
Message.where(id: message).update_all(asset_context_type: 'QuizRegradeRun')
|
||||
|
||||
Message.find(message.id).asset_context_type.should == 'Quizzes::QuizRegradeRun'
|
||||
end
|
||||
|
@ -229,19 +218,11 @@ describe Message do
|
|||
message.save
|
||||
message.asset_context_type.should == 'Quizzes::QuizSubmission'
|
||||
|
||||
message.asset_context_type = 'QuizSubmission'
|
||||
message.send(:update_without_callbacks)
|
||||
Message.where(id: message).update_all(asset_context_type: 'QuizSubmission')
|
||||
|
||||
Message.find(message.id).asset_context_type.should == 'Quizzes::QuizSubmission'
|
||||
end
|
||||
|
||||
it 'returns the context type attribute if not a quiz' do
|
||||
message = message_model
|
||||
message.asset_context = assignment_model
|
||||
message.send(:update_without_callbacks)
|
||||
|
||||
message.asset_context_type.should == 'Assignment'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -63,19 +63,9 @@ describe Progress do
|
|||
|
||||
progress.context_type.should == "Quizzes::QuizStatistics"
|
||||
|
||||
progress.context_type = 'QuizStatistics'
|
||||
progress.send(:update_without_callbacks)
|
||||
Progress.where(id: progress).update_all(context_type: 'QuizStatistics')
|
||||
|
||||
Progress.find(progress.id).context_type.should == 'Quizzes::QuizStatistics'
|
||||
end
|
||||
|
||||
it 'returns the context type attribute if not a quiz statistics relation' do
|
||||
progress = Progress.create!(tag: "test", context: user)
|
||||
|
||||
progress.context = user
|
||||
progress.send(:update_without_callbacks)
|
||||
|
||||
progress.context_type.should == 'User'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -360,8 +360,7 @@ describe "Outcome Reports" do
|
|||
|
||||
# NOTE: remove after data migration of polymorphic relationships having: QuizSubmission
|
||||
result = LearningOutcomeResult.where(artifact_type: 'Quizzes::QuizSubmission').first
|
||||
result.association_type = 'QuizSubmission'
|
||||
result.send(:update_without_callbacks)
|
||||
LearningOutcomeResult.where(id: result).update_all(association_type: 'QuizSubmission')
|
||||
|
||||
parsed = read_report(@type, {order: [0, 13]})
|
||||
parsed[0][6].should == sub.finished_at.iso8601
|
||||
|
|
|
@ -151,8 +151,7 @@ describe 'simply_versioned' do
|
|||
version = Version.find_by_versionable_id(submission.id)
|
||||
version.versionable_type.should == 'Quizzes::QuizSubmission'
|
||||
|
||||
version.versionable_type = 'QuizSubmission'
|
||||
version.send(:update_without_callbacks)
|
||||
Version.where(id: version).update_all(versionable_type: 'QuizSubmission')
|
||||
Version.find(version.id).versionable_type.should == 'Quizzes::QuizSubmission'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue