aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-05-13 15:59:06 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-05-13 18:37:39 +0900
commit21e0b675c3cef207c8c4c79a8b580c2d6c138cfa (patch)
tree0c47aa88678c5d359152f0140276c6b3e1abb175 /activerecord/test
parentbbf077363e2d200c529e4c6feba924a9537433c6 (diff)
downloadrails-21e0b675c3cef207c8c4c79a8b580c2d6c138cfa.tar.gz
rails-21e0b675c3cef207c8c4c79a8b580c2d6c138cfa.tar.bz2
rails-21e0b675c3cef207c8c4c79a8b580c2d6c138cfa.zip
Explicitly create necessary data for test
`DefaultScopingWithThreadTest` expects that there are two or more of `developers` data, but have not created data in the test. Therefore, tests may fail depending on execution order.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/scoping/default_scoping_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/scoping/default_scoping_test.rb b/activerecord/test/cases/scoping/default_scoping_test.rb
index 89fb434b27..6f1010d701 100644
--- a/activerecord/test/cases/scoping/default_scoping_test.rb
+++ b/activerecord/test/cases/scoping/default_scoping_test.rb
@@ -486,6 +486,8 @@ class DefaultScopingWithThreadTest < ActiveRecord::TestCase
end
def test_default_scope_is_threadsafe
+ 2.times { ThreadsafeDeveloper.unscoped.create! }
+
threads = []
assert_not_equal 1, ThreadsafeDeveloper.unscoped.count
@@ -504,5 +506,7 @@ class DefaultScopingWithThreadTest < ActiveRecord::TestCase
ThreadsafeDeveloper.connection.close
end
threads.each(&:join)
+ ensure
+ ThreadsafeDeveloper.unscoped.destroy_all
end
end unless in_memory_db?