1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Skip tests for non-supported isolation levels

i.e. Oracle database does not support these isolation levels.
`:read_uncommitted` `:repeatable_read`

This commit also works with other databases which do not support
these isolation levels.
This commit is contained in:
Yasuo Honda 2012-09-26 04:29:25 +09:00
parent 01cef4f3fc
commit 5826b5008f

View file

@ -44,7 +44,9 @@ class TransactionIsolationTest < ActiveRecord::TestCase
# specifies what must not happen at a certain level, not what must happen. At
# the read uncommitted level, there is nothing that must not happen.
test "read uncommitted" do
return skip "Oracle does not support read uncommitted" if current_adapter? :OracleAdapter
unless ActiveRecord::Base.connection.transaction_isolation_levels.include?(:read_uncommitted)
skip "database does not support read uncommitted isolation level"
end
Tag.transaction(isolation: :read_uncommitted) do
assert_equal 0, Tag.count
Tag2.create
@ -68,7 +70,9 @@ class TransactionIsolationTest < ActiveRecord::TestCase
# We are testing that a nonrepeatable read does not happen
test "repeatable read" do
return skip "Oracle does not support repeatble read" if current_adapter? :OracleAdapter
unless ActiveRecord::Base.connection.transaction_isolation_levels.include?(:repeatable_read)
skip "database does not support repeatable read isolation level"
end
tag = Tag.create(name: 'jon')
Tag.transaction(isolation: :repeatable_read) do