Skip to content

Commit

Permalink
fix update/save_without_callbacks for rails 3
Browse files Browse the repository at this point in the history
replaces update_without_callbacks with
 save_without_callbacks in specs

fixes ArgumentError:
 "tried to create Proc object without a block"

Change-Id: I62275348cd9fff967d21646e7cd963c4b531790e
Reviewed-on: https://gerrit.instructure.com/29255
Tested-by: Jenkins <[email protected]>
Reviewed-by: Cody Cutrer <[email protected]>
Product-Review: James Williams  <[email protected]>
QA-Review: James Williams  <[email protected]>
  • Loading branch information
maneframe committed Jan 31, 2014
1 parent cc4c82b commit bb31a02
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/skip_callback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class << self
elsif name == :save
yield
else
run_callbacks_orig(name, &Proc.new)
run_callbacks_orig(name, &Proc.new{})
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/cloned_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
cloned_item.original_item_type.should == 'Quizzes::Quiz'

cloned_item.original_item_type = 'Quiz'
cloned_item.send(:update_without_callbacks)
cloned_item.send(:save_without_callbacks)

ClonedItem.first.original_item_type.should == 'Quizzes::Quiz'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/content_tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
content_tag.content_type.should == 'Quizzes::Quiz'

content_tag.content_type = 'Quiz'
content_tag.send(:update_without_callbacks)
content_tag.send(:save_without_callbacks)

ContentTag.find(content_tag.id).content_type.should == 'Quizzes::Quiz'
end
Expand Down
9 changes: 4 additions & 5 deletions spec/models/learning_outcome_result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ def create_learning_outcome_result
learning_outcome_result.association_type.should == 'Quizzes::Quiz'

learning_outcome_result.association_type = 'Quiz'
learning_outcome_result.send(:update_without_callbacks)
learning_outcome_result.send(:save_without_callbacks)

LearningOutcomeResult.first.association_type.should == 'Quizzes::Quiz'
end

it 'returns the association type attribute if not a quiz' do
learning_outcome_result = create_learning_outcome_result
learning_outcome_result.association_object = assignment_model
learning_outcome_result.send(:update_without_callbacks)

learning_outcome_result.send(:save_without_callbacks)
learning_outcome_result.association_type.should == 'Assignment'
end
end
Expand All @@ -59,15 +58,15 @@ def create_learning_outcome_result
learning_outcome_result.associated_asset_type.should == 'Quizzes::Quiz'

learning_outcome_result.associated_asset_type = 'Quiz'
learning_outcome_result.send(:update_without_callbacks)
learning_outcome_result.send(:save_without_callbacks)

LearningOutcomeResult.first.associated_asset_type.should == 'Quizzes::Quiz'
end

it 'returns the associated asset type attribute if not a quiz' do
learning_outcome_result = create_learning_outcome_result
learning_outcome_result.associated_asset = assignment_model
learning_outcome_result.send(:update_without_callbacks)
learning_outcome_result.send(:save_without_callbacks)

learning_outcome_result.associated_asset_type.should == 'Assignment'
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/polymorphic_type_override_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ContentTag
fizz_buzz.content_type.should == 'Quizzes::Quiz'

fizz_buzz.content_type = 'OldClassInDatabase'
fizz_buzz.send(:update_without_callbacks)
fizz_buzz.send(:save_without_callbacks)

updated_fizz_buzz = ContentTag.first
updated_fizz_buzz.content_type.should == 'Quizzes::Quiz'
Expand All @@ -51,7 +51,7 @@ class ContentTag

fizz_buzz.content_type = 'OldClassInDatabase'
fizz_buzz.context_type = 'AnotherOldClassInDatabase'
fizz_buzz.send(:update_without_callbacks)
fizz_buzz.send(:save_without_callbacks)

updated_fizz_buzz = ContentTag.first

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
# NOTE: remove after data migration of polymorphic relationships having: Quiz
result = LearningOutcomeResult.where(association_type: 'Quizzes::Quiz').first
result.association_type = 'Quiz'
result.send(:update_without_callbacks)
result.send(:save_without_callbacks)

parsed = read_report(@type, {order: [0, 13]})
parsed[2][5].should == 'assignment'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class Woozel < ActiveRecord::Base
version.versionable_type.should == 'Quizzes::Quiz'

version.versionable_type = 'Quiz'
version.send(:update_without_callbacks)
version.send(:save_without_callbacks)
Version.find(version.id).versionable_type.should == 'Quizzes::Quiz'
end

Expand Down

0 comments on commit bb31a02

Please sign in to comment.