Skip to content

Commit

Permalink
No need to use #send with public methods
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Jan 16, 2014
1 parent c253b8e commit 7b11b06
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions activerecord/test/cases/transaction_callbacks_test.rb
Expand Up @@ -30,14 +30,14 @@ class TopicWithCallbacks < ActiveRecord::Base

has_many :replies, class_name: "ReplyWithCallbacks", foreign_key: "parent_id"

after_commit{|record| record.send(:do_after_commit, nil)}
after_commit(:on => :create){|record| record.send(:do_after_commit, :create)}
after_commit(:on => :update){|record| record.send(:do_after_commit, :update)}
after_commit(:on => :destroy){|record| record.send(:do_after_commit, :destroy)}
after_rollback{|record| record.send(:do_after_rollback, nil)}
after_rollback(:on => :create){|record| record.send(:do_after_rollback, :create)}
after_rollback(:on => :update){|record| record.send(:do_after_rollback, :update)}
after_rollback(:on => :destroy){|record| record.send(:do_after_rollback, :destroy)}
after_commit { |record| record.do_after_commit(nil) }
after_commit(on: :create) { |record| record.do_after_commit(:create) }
after_commit(on: :update) { |record| record.do_after_commit(:update) }
after_commit(on: :destroy) { |record| record.do_after_commit(:destroy) }
after_rollback { |record| record.do_after_rollback(nil) }
after_rollback(on: :create) { |record| record.do_after_rollback(:create) }
after_rollback(on: :update) { |record| record.do_after_rollback(:update) }
after_rollback(on: :destroy) { |record| record.do_after_rollback(:destroy) }

def history
@history ||= []
Expand Down Expand Up @@ -303,11 +303,11 @@ def @first.last_after_transaction_error; @last_transaction_error; end
end

def test_after_rollback_callbacks_should_validate_on_condition
assert_raise(ArgumentError) { Topic.send(:after_rollback, :on => :save) }
assert_raise(ArgumentError) { Topic.after_rollback(on: :save) }
end

def test_after_commit_callbacks_should_validate_on_condition
assert_raise(ArgumentError) { Topic.send(:after_commit, :on => :save) }
assert_raise(ArgumentError) { Topic.after_commit(on: :save) }
end

def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_call_callbacks_on_the_parent_object
Expand Down

0 comments on commit 7b11b06

Please sign in to comment.