aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/scoping
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-08 13:57:51 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-08 13:59:07 -0200
commitbd09afb5fb3e2047c605660dac6ef4495c419716 (patch)
tree205df2ab04d92e8093c341e132726325e9c40656 /activerecord/test/cases/scoping
parent3d5e83fea4cc070fc55da535b7777a914301e284 (diff)
downloadrails-bd09afb5fb3e2047c605660dac6ef4495c419716.tar.gz
rails-bd09afb5fb3e2047c605660dac6ef4495c419716.tar.bz2
rails-bd09afb5fb3e2047c605660dac6ef4495c419716.zip
Don't skip tests if we don't need to.
We can conditional define the tests depending on the adapter or connection. Lets keep the skip for fail tests that need to be fixed.
Diffstat (limited to 'activerecord/test/cases/scoping')
-rw-r--r--activerecord/test/cases/scoping/default_scoping_test.rb48
1 files changed, 23 insertions, 25 deletions
diff --git a/activerecord/test/cases/scoping/default_scoping_test.rb b/activerecord/test/cases/scoping/default_scoping_test.rb
index 4fd9d6f52a..2fbe19ab06 100644
--- a/activerecord/test/cases/scoping/default_scoping_test.rb
+++ b/activerecord/test/cases/scoping/default_scoping_test.rb
@@ -54,14 +54,14 @@ class DefaultScopingTest < ActiveRecord::TestCase
assert_equal 'Jamis', DeveloperCalledJamis.create!.name
end
- def test_default_scoping_with_threads
- skip "in-memory database mustn't disconnect" if in_memory_db?
-
- 2.times do
- Thread.new {
- assert DeveloperOrderedBySalary.all.to_sql.include?('salary DESC')
- DeveloperOrderedBySalary.connection.close
- }.join
+ unless in_memory_db?
+ def test_default_scoping_with_threads
+ 2.times do
+ Thread.new {
+ assert DeveloperOrderedBySalary.all.to_sql.include?('salary DESC')
+ DeveloperOrderedBySalary.connection.close
+ }.join
+ end
end
end
@@ -362,23 +362,21 @@ class DefaultScopingTest < ActiveRecord::TestCase
assert_equal 1, DeveloperWithIncludes.where(:audit_logs => { :message => 'foo' }).count
end
- def test_default_scope_is_threadsafe
- if in_memory_db?
- skip "in memory db can't share a db between threads"
+ unless in_memory_db?
+ def test_default_scope_is_threadsafe
+ threads = []
+ assert_not_equal 1, ThreadsafeDeveloper.unscoped.count
+
+ threads << Thread.new do
+ Thread.current[:long_default_scope] = true
+ assert_equal 1, ThreadsafeDeveloper.all.to_a.count
+ ThreadsafeDeveloper.connection.close
+ end
+ threads << Thread.new do
+ assert_equal 1, ThreadsafeDeveloper.all.to_a.count
+ ThreadsafeDeveloper.connection.close
+ end
+ threads.each(&:join)
end
-
- threads = []
- assert_not_equal 1, ThreadsafeDeveloper.unscoped.count
-
- threads << Thread.new do
- Thread.current[:long_default_scope] = true
- assert_equal 1, ThreadsafeDeveloper.all.to_a.count
- ThreadsafeDeveloper.connection.close
- end
- threads << Thread.new do
- assert_equal 1, ThreadsafeDeveloper.all.to_a.count
- ThreadsafeDeveloper.connection.close
- end
- threads.each(&:join)
end
end