Skip to content

Commit 14bc43d

Browse files
committed
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>
1 parent ed812b9 commit 14bc43d

7 files changed

Lines changed: 10 additions & 63 deletions

File tree

spec/models/attachment_spec.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,22 +1609,10 @@ def attachment_with_scribd_doc(doc = fake_scribd_doc, opts = {})
16091609
attachment.save
16101610
attachment.context_type.should == "Quizzes::QuizStatistics"
16111611

1612-
attachment.context_type = 'QuizStatistics'
1613-
attachment.send(:update_without_callbacks)
1612+
Attachment.where(id: attachment).update_all(context_type: 'QuizStatistics')
16141613

16151614
Attachment.find(attachment.id).context_type.should == 'Quizzes::QuizStatistics'
16161615
end
1617-
1618-
it 'returns the context type attribute if not a quiz statistics relation' do
1619-
attachment = Attachment.create!(context: assignment_model,
1620-
filename: "foo.txt",
1621-
uploaded_data: StringIO.new("bar"))
1622-
1623-
attachment.context = assignment_model
1624-
attachment.send(:update_without_callbacks)
1625-
1626-
attachment.context_type.should == 'Assignment'
1627-
end
16281616
end
16291617

16301618
end

spec/models/delayed_notification_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626

2727
notification.asset_type.should == 'Quizzes::QuizSubmission'
2828

29-
notification.asset_type = 'QuizSubmission'
30-
notification.send(:update_without_callbacks)
29+
DelayedNotification.where(id: notification).update_all(asset_type: 'QuizSubmission')
3130

3231
DelayedNotification.find(notification.id).asset_type.should == 'Quizzes::QuizSubmission'
3332
end

spec/models/learning_outcome_result_spec.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,10 @@ def create_learning_outcome_result
6161
learning_outcome_result.save
6262
learning_outcome_result.artifact_type.should == 'Quizzes::QuizSubmission'
6363

64-
learning_outcome_result.association_type = 'QuizSubmission'
65-
learning_outcome_result.send(:update_without_callbacks)
64+
LearningOutcomeResult.where(id: learning_outcome_result).update_all(association_type: 'QuizSubmission')
6665

6766
LearningOutcomeResult.find(learning_outcome_result.id).artifact_type.should == 'Quizzes::QuizSubmission'
6867
end
69-
70-
it 'returns the artifact type attribute if not a quiz submission' do
71-
learning_outcome_result = create_learning_outcome_result
72-
learning_outcome_result.artifact = assignment_model
73-
learning_outcome_result.send(:update_without_callbacks)
74-
75-
learning_outcome_result.artifact_type.should == 'Assignment'
76-
end
7768
end
7869

7970
describe '.associated_asset_type' do

spec/models/message_spec.rb

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@
178178
message.save
179179
message.context_type.should == "Quizzes::QuizRegradeRun"
180180

181-
message.context_type = 'QuizRegradeRun'
182-
message.send(:update_without_callbacks)
181+
Message.where(id: message).update_all(context_type: 'QuizRegradeRun')
183182

184183
Message.find(message.id).context_type.should == 'Quizzes::QuizRegradeRun'
185184
end
@@ -191,19 +190,10 @@
191190
message.save
192191
message.context_type.should == 'Quizzes::QuizSubmission'
193192

194-
message.context_type = 'QuizSubmission'
195-
message.send(:update_without_callbacks)
193+
Message.where(id: message).update_all(context_type: 'QuizSubmission')
196194

197195
Message.find(message.id).context_type.should == 'Quizzes::QuizSubmission'
198196
end
199-
200-
it 'returns the context type attribute if not a quiz' do
201-
message = message_model
202-
message.context = assignment_model
203-
message.send(:update_without_callbacks)
204-
205-
message.context_type.should == 'Assignment'
206-
end
207197
end
208198

209199
describe '.asset_context_type' do
@@ -216,8 +206,7 @@
216206
message.save
217207
message.asset_context_type.should == "Quizzes::QuizRegradeRun"
218208

219-
message.asset_context_type = 'QuizRegradeRun'
220-
message.send(:update_without_callbacks)
209+
Message.where(id: message).update_all(asset_context_type: 'QuizRegradeRun')
221210

222211
Message.find(message.id).asset_context_type.should == 'Quizzes::QuizRegradeRun'
223212
end
@@ -229,19 +218,11 @@
229218
message.save
230219
message.asset_context_type.should == 'Quizzes::QuizSubmission'
231220

232-
message.asset_context_type = 'QuizSubmission'
233-
message.send(:update_without_callbacks)
221+
Message.where(id: message).update_all(asset_context_type: 'QuizSubmission')
234222

235223
Message.find(message.id).asset_context_type.should == 'Quizzes::QuizSubmission'
236224
end
237225

238-
it 'returns the context type attribute if not a quiz' do
239-
message = message_model
240-
message.asset_context = assignment_model
241-
message.send(:update_without_callbacks)
242-
243-
message.asset_context_type.should == 'Assignment'
244-
end
245226
end
246227

247228
end

spec/models/progress_spec.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,9 @@ def self.fail(progress)
6363

6464
progress.context_type.should == "Quizzes::QuizStatistics"
6565

66-
progress.context_type = 'QuizStatistics'
67-
progress.send(:update_without_callbacks)
66+
Progress.where(id: progress).update_all(context_type: 'QuizStatistics')
6867

6968
Progress.find(progress.id).context_type.should == 'Quizzes::QuizStatistics'
7069
end
71-
72-
it 'returns the context type attribute if not a quiz statistics relation' do
73-
progress = Progress.create!(tag: "test", context: user)
74-
75-
progress.context = user
76-
progress.send(:update_without_callbacks)
77-
78-
progress.context_type.should == 'User'
79-
end
8070
end
8171
end

vendor/plugins/account_reports/spec_canvas/outcome_reports_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@
360360

361361
# NOTE: remove after data migration of polymorphic relationships having: QuizSubmission
362362
result = LearningOutcomeResult.where(artifact_type: 'Quizzes::QuizSubmission').first
363-
result.association_type = 'QuizSubmission'
364-
result.send(:update_without_callbacks)
363+
LearningOutcomeResult.where(id: result).update_all(association_type: 'QuizSubmission')
365364

366365
parsed = read_report(@type, {order: [0, 13]})
367366
parsed[0][6].should == sub.finished_at.iso8601

vendor/plugins/simply_versioned/spec_canvas/simply_versioned_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ class Woozel < ActiveRecord::Base
151151
version = Version.find_by_versionable_id(submission.id)
152152
version.versionable_type.should == 'Quizzes::QuizSubmission'
153153

154-
version.versionable_type = 'QuizSubmission'
155-
version.send(:update_without_callbacks)
154+
Version.where(id: version).update_all(versionable_type: 'QuizSubmission')
156155
Version.find(version.id).versionable_type.should == 'Quizzes::QuizSubmission'
157156
end
158157

0 commit comments

Comments
 (0)