This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,7 @@ def instance.run_callbacks(*args); yield; end
306
306
def instance . _run_save_callbacks ( *args ) ; yield ; end
307
307
def instance . _run_create_callbacks ( *args ) ; yield ; end
308
308
def instance . _run_update_callbacks ( *args ) ; yield ; end
309
+ def instance . _run_commit_callbacks ( *args ) ; yield ; end
309
310
else
310
311
# AR 2.x
311
312
def instance . callback ( *args )
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
s . test_files = s . files . select { |path | path =~ /^test\/ .*_test.rb/ }
36
36
s . add_development_dependency 'activerecord' , '~> 3.1'
37
37
s . add_development_dependency 'sqlite3'
38
+ s . add_development_dependency 'test_after_commit'
38
39
39
40
s . require_paths = %w[ lib ]
40
41
end
Original file line number Diff line number Diff line change 16
16
dbfile = File . expand_path ( '../db' , __FILE__ )
17
17
File . unlink dbfile if File . exist? ( dbfile )
18
18
ActiveRecord ::Base . establish_connection ( :adapter => "sqlite3" , :database => dbfile )
19
+ require 'test_after_commit'
19
20
20
21
# load schema
21
22
ActiveRecord ::Migration . verbose = false
@@ -561,6 +562,9 @@ def test_loader_saves_without_callbacks
561
562
# note when a record is saved with callbacks
562
563
callbacks = false
563
564
User . class_eval { after_save { callbacks = true } }
565
+ User . class_eval { after_create { callbacks = true } }
566
+ User . class_eval { after_update { callbacks = true } }
567
+ User . class_eval { after_commit { callbacks = true } }
564
568
565
569
# check our assumptions
566
570
user = User . create ( :login => 'defunkt' )
You can’t perform that action at this time.
0 commit comments