Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
eaf38575
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eaf38575
编写于
3月 16, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19282 from brandonweiss/better-name-for-transactional-fixtures
Renaming transactional fixtures to transactional tests
上级
82c2baf5
09658635
变更
53
隐藏空白更改
内联
并排
Showing
53 changed file
with
143 addition
and
89 deletion
+143
-89
actionview/test/active_record_unit.rb
actionview/test/active_record_unit.rb
+1
-1
activejob/test/support/integration/test_case_helpers.rb
activejob/test/support/integration/test_case_helpers.rb
+1
-1
activerecord/CHANGELOG.md
activerecord/CHANGELOG.md
+6
-0
activerecord/lib/active_record/fixtures.rb
activerecord/lib/active_record/fixtures.rb
+20
-8
activerecord/test/cases/adapter_test.rb
activerecord/test/cases/adapter_test.rb
+1
-1
activerecord/test/cases/adapters/mysql/consistency_test.rb
activerecord/test/cases/adapters/mysql/consistency_test.rb
+1
-1
activerecord/test/cases/adapters/mysql/reserved_word_test.rb
activerecord/test/cases/adapters/mysql/reserved_word_test.rb
+1
-1
activerecord/test/cases/adapters/mysql/unsigned_type_test.rb
activerecord/test/cases/adapters/mysql/unsigned_type_test.rb
+1
-1
activerecord/test/cases/adapters/mysql2/boolean_test.rb
activerecord/test/cases/adapters/mysql2/boolean_test.rb
+1
-1
activerecord/test/cases/adapters/mysql2/reserved_word_test.rb
...verecord/test/cases/adapters/mysql2/reserved_word_test.rb
+1
-1
activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb
...verecord/test/cases/adapters/mysql2/unsigned_type_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/datatype_test.rb
activerecord/test/cases/adapters/postgresql/datatype_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/extension_migration_test.rb
...est/cases/adapters/postgresql/extension_migration_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/range_test.rb
activerecord/test/cases/adapters/postgresql/range_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb
...t/cases/adapters/postgresql/referential_integrity_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
...st/cases/adapters/postgresql/schema_authorization_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/schema_test.rb
activerecord/test/cases/adapters/postgresql/schema_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/timestamp_test.rb
...verecord/test/cases/adapters/postgresql/timestamp_test.rb
+1
-1
activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
...ecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
+1
-1
activerecord/test/cases/ar_schema_test.rb
activerecord/test/cases/ar_schema_test.rb
+1
-1
activerecord/test/cases/associations/has_one_associations_test.rb
...cord/test/cases/associations/has_one_associations_test.rb
+1
-1
activerecord/test/cases/associations/join_model_test.rb
activerecord/test/cases/associations/join_model_test.rb
+1
-1
activerecord/test/cases/associations/required_test.rb
activerecord/test/cases/associations/required_test.rb
+1
-1
activerecord/test/cases/autosave_association_test.rb
activerecord/test/cases/autosave_association_test.rb
+13
-13
activerecord/test/cases/date_time_precision_test.rb
activerecord/test/cases/date_time_precision_test.rb
+1
-1
activerecord/test/cases/defaults_test.rb
activerecord/test/cases/defaults_test.rb
+3
-3
activerecord/test/cases/disconnected_test.rb
activerecord/test/cases/disconnected_test.rb
+1
-1
activerecord/test/cases/fixtures_test.rb
activerecord/test/cases/fixtures_test.rb
+10
-10
activerecord/test/cases/helper.rb
activerecord/test/cases/helper.rb
+1
-1
activerecord/test/cases/hot_compatibility_test.rb
activerecord/test/cases/hot_compatibility_test.rb
+1
-1
activerecord/test/cases/invalid_connection_test.rb
activerecord/test/cases/invalid_connection_test.rb
+1
-1
activerecord/test/cases/locking_test.rb
activerecord/test/cases/locking_test.rb
+3
-3
activerecord/test/cases/migration/change_schema_test.rb
activerecord/test/cases/migration/change_schema_test.rb
+1
-1
activerecord/test/cases/migration/column_attributes_test.rb
activerecord/test/cases/migration/column_attributes_test.rb
+1
-1
activerecord/test/cases/migration/columns_test.rb
activerecord/test/cases/migration/columns_test.rb
+1
-1
activerecord/test/cases/migration/logger_test.rb
activerecord/test/cases/migration/logger_test.rb
+1
-1
activerecord/test/cases/migration/references_statements_test.rb
...record/test/cases/migration/references_statements_test.rb
+1
-1
activerecord/test/cases/migration/rename_table_test.rb
activerecord/test/cases/migration/rename_table_test.rb
+1
-1
activerecord/test/cases/migration_test.rb
activerecord/test/cases/migration_test.rb
+1
-1
activerecord/test/cases/migrator_test.rb
activerecord/test/cases/migrator_test.rb
+1
-1
activerecord/test/cases/multiple_db_test.rb
activerecord/test/cases/multiple_db_test.rb
+1
-1
activerecord/test/cases/nested_attributes_test.rb
activerecord/test/cases/nested_attributes_test.rb
+2
-2
activerecord/test/cases/persistence_test.rb
activerecord/test/cases/persistence_test.rb
+1
-1
activerecord/test/cases/pooled_connections_test.rb
activerecord/test/cases/pooled_connections_test.rb
+1
-1
activerecord/test/cases/primary_keys_test.rb
activerecord/test/cases/primary_keys_test.rb
+4
-4
activerecord/test/cases/schema_dumper_test.rb
activerecord/test/cases/schema_dumper_test.rb
+1
-1
activerecord/test/cases/test_fixtures_test.rb
activerecord/test/cases/test_fixtures_test.rb
+36
-0
activerecord/test/cases/time_precision_test.rb
activerecord/test/cases/time_precision_test.rb
+1
-1
activerecord/test/cases/timestamp_test.rb
activerecord/test/cases/timestamp_test.rb
+1
-1
activerecord/test/cases/transaction_callbacks_test.rb
activerecord/test/cases/transaction_callbacks_test.rb
+1
-1
activerecord/test/cases/transaction_isolation_test.rb
activerecord/test/cases/transaction_isolation_test.rb
+2
-2
activerecord/test/cases/transactions_test.rb
activerecord/test/cases/transactions_test.rb
+2
-2
activerecord/test/cases/unconnected_test.rb
activerecord/test/cases/unconnected_test.rb
+1
-1
未找到文件。
actionview/test/active_record_unit.rb
浏览文件 @
eaf38575
...
@@ -76,7 +76,7 @@ class ActiveRecordTestCase < ActionController::TestCase
...
@@ -76,7 +76,7 @@ class ActiveRecordTestCase < ActionController::TestCase
# Set our fixture path
# Set our fixture path
if
ActiveRecordTestConnector
.
able_to_connect
if
ActiveRecordTestConnector
.
able_to_connect
self
.
fixture_path
=
[
FIXTURE_LOAD_PATH
]
self
.
fixture_path
=
[
FIXTURE_LOAD_PATH
]
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
end
end
def
self
.
fixtures
(
*
args
)
def
self
.
fixtures
(
*
args
)
...
...
activejob/test/support/integration/test_case_helpers.rb
浏览文件 @
eaf38575
...
@@ -5,7 +5,7 @@ module TestCaseHelpers
...
@@ -5,7 +5,7 @@ module TestCaseHelpers
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
included
do
included
do
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
clear_jobs
clear_jobs
...
...
activerecord/CHANGELOG.md
浏览文件 @
eaf38575
*
Renaming
`use_transactional_fixtures`
to
`use_transactional_tests`
for clarity.
Fixes #18864.
*Brandon Weiss*
*
Increase pg gem version requirement to
`~> 0.18`
. Earlier versions of the
*
Increase pg gem version requirement to
`~> 0.18`
. Earlier versions of the
pg gem are known to have problems with Ruby 2.2.
pg gem are known to have problems with Ruby 2.2.
...
...
activerecord/lib/active_record/fixtures.rb
浏览文件 @
eaf38575
...
@@ -139,13 +139,13 @@ class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
...
@@ -139,13 +139,13 @@ class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
# name: kitten.png
# name: kitten.png
# sha: <%= file_sha 'files/kitten.png' %>
# sha: <%= file_sha 'files/kitten.png' %>
#
#
# = Transactional
Fixture
s
# = Transactional
Test
s
#
#
# Test cases can use begin+rollback to isolate their changes to the database instead of having to
# Test cases can use begin+rollback to isolate their changes to the database instead of having to
# delete+insert for every test case.
# delete+insert for every test case.
#
#
# class FooTest < ActiveSupport::TestCase
# class FooTest < ActiveSupport::TestCase
# self.use_transactional_
fixture
s = true
# self.use_transactional_
test
s = true
#
#
# test "godzilla" do
# test "godzilla" do
# assert !Foo.all.empty?
# assert !Foo.all.empty?
...
@@ -159,14 +159,14 @@ class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
...
@@ -159,14 +159,14 @@ class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
# end
# end
#
#
# If you preload your test database with all fixture data (probably in the rake task) and use
# If you preload your test database with all fixture data (probably in the rake task) and use
# transactional
fixture
s, then you may omit all fixtures declarations in your test cases since
# transactional
test
s, then you may omit all fixtures declarations in your test cases since
# all the data's already there and every case rolls back its changes.
# all the data's already there and every case rolls back its changes.
#
#
# In order to use instantiated fixtures with preloaded data, set +self.pre_loaded_fixtures+ to
# In order to use instantiated fixtures with preloaded data, set +self.pre_loaded_fixtures+ to
# true. This will provide access to fixture data for every table that has been loaded through
# true. This will provide access to fixture data for every table that has been loaded through
# fixtures (depending on the value of +use_instantiated_fixtures+).
# fixtures (depending on the value of +use_instantiated_fixtures+).
#
#
# When *not* to use transactional
fixture
s:
# When *not* to use transactional
test
s:
#
#
# 1. You're testing whether a transaction works correctly. Nested transactions don't commit until
# 1. You're testing whether a transaction works correctly. Nested transactions don't commit until
# all parent transactions commit, particularly, the fixtures transaction which is begun in setup
# all parent transactions commit, particularly, the fixtures transaction which is begun in setup
...
@@ -835,13 +835,15 @@ def after_teardown
...
@@ -835,13 +835,15 @@ def after_teardown
class_attribute
:fixture_path
,
:instance_writer
=>
false
class_attribute
:fixture_path
,
:instance_writer
=>
false
class_attribute
:fixture_table_names
class_attribute
:fixture_table_names
class_attribute
:fixture_class_names
class_attribute
:fixture_class_names
class_attribute
:use_transactional_tests
class_attribute
:use_transactional_fixtures
class_attribute
:use_transactional_fixtures
class_attribute
:use_instantiated_fixtures
# true, false, or :no_instances
class_attribute
:use_instantiated_fixtures
# true, false, or :no_instances
class_attribute
:pre_loaded_fixtures
class_attribute
:pre_loaded_fixtures
class_attribute
:config
class_attribute
:config
singleton_class
.
deprecate
'use_transactional_fixtures='
=>
'use use_transactional_tests= instead'
self
.
fixture_table_names
=
[]
self
.
fixture_table_names
=
[]
self
.
use_transactional_fixtures
=
true
self
.
use_instantiated_fixtures
=
false
self
.
use_instantiated_fixtures
=
false
self
.
pre_loaded_fixtures
=
false
self
.
pre_loaded_fixtures
=
false
self
.
config
=
ActiveRecord
::
Base
self
.
config
=
ActiveRecord
::
Base
...
@@ -849,6 +851,16 @@ def after_teardown
...
@@ -849,6 +851,16 @@ def after_teardown
self
.
fixture_class_names
=
Hash
.
new
do
|
h
,
fixture_set_name
|
self
.
fixture_class_names
=
Hash
.
new
do
|
h
,
fixture_set_name
|
h
[
fixture_set_name
]
=
ActiveRecord
::
FixtureSet
.
default_fixture_model_name
(
fixture_set_name
,
self
.
config
)
h
[
fixture_set_name
]
=
ActiveRecord
::
FixtureSet
.
default_fixture_model_name
(
fixture_set_name
,
self
.
config
)
end
end
silence_warnings
do
define_singleton_method
:use_transactional_tests
do
if
use_transactional_fixtures
.
nil?
true
else
use_transactional_fixtures
end
end
end
end
end
module
ClassMethods
module
ClassMethods
...
@@ -919,13 +931,13 @@ def uses_transaction?(method)
...
@@ -919,13 +931,13 @@ def uses_transaction?(method)
end
end
def
run_in_transaction?
def
run_in_transaction?
use_transactional_
fixture
s
&&
use_transactional_
test
s
&&
!
self
.
class
.
uses_transaction?
(
method_name
)
!
self
.
class
.
uses_transaction?
(
method_name
)
end
end
def
setup_fixtures
(
config
=
ActiveRecord
::
Base
)
def
setup_fixtures
(
config
=
ActiveRecord
::
Base
)
if
pre_loaded_fixtures
&&
!
use_transactional_
fixture
s
if
pre_loaded_fixtures
&&
!
use_transactional_
test
s
raise
RuntimeError
,
'pre_loaded_fixtures requires use_transactional_
fixture
s'
raise
RuntimeError
,
'pre_loaded_fixtures requires use_transactional_
test
s'
end
end
@fixture_cache
=
{}
@fixture_cache
=
{}
...
...
activerecord/test/cases/adapter_test.rb
浏览文件 @
eaf38575
...
@@ -226,7 +226,7 @@ def test_log_invalid_encoding
...
@@ -226,7 +226,7 @@ def test_log_invalid_encoding
end
end
class
AdapterTestWithoutTransaction
<
ActiveRecord
::
TestCase
class
AdapterTestWithoutTransaction
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Klass
<
ActiveRecord
::
Base
class
Klass
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/adapters/mysql/consistency_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
MysqlConsistencyTest
<
ActiveRecord
::
TestCase
class
MysqlConsistencyTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Consistency
<
ActiveRecord
::
Base
class
Consistency
<
ActiveRecord
::
Base
self
.
table_name
=
"mysql_consistency"
self
.
table_name
=
"mysql_consistency"
...
...
activerecord/test/cases/adapters/mysql/reserved_word_test.rb
浏览文件 @
eaf38575
...
@@ -71,7 +71,7 @@ def test_introspect
...
@@ -71,7 +71,7 @@ def test_introspect
#fixtures
#fixtures
self
.
use_instantiated_fixtures
=
true
self
.
use_instantiated_fixtures
=
true
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
#activerecord model class with reserved-word table name
#activerecord model class with reserved-word table name
def
test_activerecord_model
def
test_activerecord_model
...
...
activerecord/test/cases/adapters/mysql/unsigned_type_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
UnsignedTypeTest
<
ActiveRecord
::
TestCase
class
UnsignedTypeTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
UnsignedType
<
ActiveRecord
::
Base
class
UnsignedType
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/adapters/mysql2/boolean_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
Mysql2BooleanTest
<
ActiveRecord
::
TestCase
class
Mysql2BooleanTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
BooleanType
<
ActiveRecord
::
Base
class
BooleanType
<
ActiveRecord
::
Base
self
.
table_name
=
"mysql_booleans"
self
.
table_name
=
"mysql_booleans"
...
...
activerecord/test/cases/adapters/mysql2/reserved_word_test.rb
浏览文件 @
eaf38575
...
@@ -71,7 +71,7 @@ def test_introspect
...
@@ -71,7 +71,7 @@ def test_introspect
#fixtures
#fixtures
self
.
use_instantiated_fixtures
=
true
self
.
use_instantiated_fixtures
=
true
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
#activerecord model class with reserved-word table name
#activerecord model class with reserved-word table name
def
test_activerecord_model
def
test_activerecord_model
...
...
activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
UnsignedTypeTest
<
ActiveRecord
::
TestCase
class
UnsignedTypeTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
UnsignedType
<
ActiveRecord
::
Base
class
UnsignedType
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/adapters/postgresql/datatype_test.rb
浏览文件 @
eaf38575
...
@@ -12,7 +12,7 @@ class PostgresqlLtree < ActiveRecord::Base
...
@@ -12,7 +12,7 @@ class PostgresqlLtree < ActiveRecord::Base
end
end
class
PostgresqlDataTypeTest
<
ActiveRecord
::
TestCase
class
PostgresqlDataTypeTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
@connection
=
ActiveRecord
::
Base
.
connection
@connection
=
ActiveRecord
::
Base
.
connection
...
...
activerecord/test/cases/adapters/postgresql/extension_migration_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
PostgresqlExtensionMigrationTest
<
ActiveRecord
::
TestCase
class
PostgresqlExtensionMigrationTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
EnableHstore
<
ActiveRecord
::
Migration
class
EnableHstore
<
ActiveRecord
::
Migration
def
change
def
change
...
...
activerecord/test/cases/adapters/postgresql/range_test.rb
浏览文件 @
eaf38575
...
@@ -7,7 +7,7 @@ class PostgresqlRange < ActiveRecord::Base
...
@@ -7,7 +7,7 @@ class PostgresqlRange < ActiveRecord::Base
end
end
class
PostgresqlRangeTest
<
ActiveRecord
::
TestCase
class
PostgresqlRangeTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
include
ConnectionHelper
include
ConnectionHelper
def
setup
def
setup
...
...
activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb
浏览文件 @
eaf38575
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require
'support/connection_helper'
require
'support/connection_helper'
class
PostgreSQLReferentialIntegrityTest
<
ActiveRecord
::
TestCase
class
PostgreSQLReferentialIntegrityTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
include
ConnectionHelper
include
ConnectionHelper
...
...
activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@ class SchemaThing < ActiveRecord::Base
...
@@ -4,7 +4,7 @@ class SchemaThing < ActiveRecord::Base
end
end
class
SchemaAuthorizationTest
<
ActiveRecord
::
TestCase
class
SchemaAuthorizationTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
TABLE_NAME
=
'schema_things'
TABLE_NAME
=
'schema_things'
COLUMNS
=
[
COLUMNS
=
[
...
...
activerecord/test/cases/adapters/postgresql/schema_test.rb
浏览文件 @
eaf38575
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
require
'support/schema_dumping_helper'
require
'support/schema_dumping_helper'
class
SchemaTest
<
ActiveRecord
::
TestCase
class
SchemaTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
SCHEMA_NAME
=
'test_schema'
SCHEMA_NAME
=
'test_schema'
SCHEMA2_NAME
=
'test_schema2'
SCHEMA2_NAME
=
'test_schema2'
...
...
activerecord/test/cases/adapters/postgresql/timestamp_test.rb
浏览文件 @
eaf38575
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
class
PostgresqlTimestampTest
<
ActiveRecord
::
TestCase
class
PostgresqlTimestampTest
<
ActiveRecord
::
TestCase
class
PostgresqlTimestampWithZone
<
ActiveRecord
::
Base
;
end
class
PostgresqlTimestampWithZone
<
ActiveRecord
::
Base
;
end
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
@connection
=
ActiveRecord
::
Base
.
connection
@connection
=
ActiveRecord
::
Base
.
connection
...
...
activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
浏览文件 @
eaf38575
...
@@ -8,7 +8,7 @@ module ConnectionAdapters
...
@@ -8,7 +8,7 @@ module ConnectionAdapters
class
SQLite3AdapterTest
<
ActiveRecord
::
TestCase
class
SQLite3AdapterTest
<
ActiveRecord
::
TestCase
include
DdlHelper
include
DdlHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
DualEncoding
<
ActiveRecord
::
Base
class
DualEncoding
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/ar_schema_test.rb
浏览文件 @
eaf38575
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
if
ActiveRecord
::
Base
.
connection
.
supports_migrations?
if
ActiveRecord
::
Base
.
connection
.
supports_migrations?
class
ActiveRecordSchemaTest
<
ActiveRecord
::
TestCase
class
ActiveRecordSchemaTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
@original_verbose
=
ActiveRecord
::
Migration
.
verbose
@original_verbose
=
ActiveRecord
::
Migration
.
verbose
...
...
activerecord/test/cases/associations/has_one_associations_test.rb
浏览文件 @
eaf38575
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
require
'models/post'
require
'models/post'
class
HasOneAssociationsTest
<
ActiveRecord
::
TestCase
class
HasOneAssociationsTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
fixtures
:accounts
,
:companies
,
:developers
,
:projects
,
:developers_projects
,
:ships
,
:pirates
fixtures
:accounts
,
:companies
,
:developers
,
:projects
,
:developers_projects
,
:ships
,
:pirates
def
setup
def
setup
...
...
activerecord/test/cases/associations/join_model_test.rb
浏览文件 @
eaf38575
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
require
'models/car'
require
'models/car'
class
AssociationsJoinModelTest
<
ActiveRecord
::
TestCase
class
AssociationsJoinModelTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
fixtures
:posts
,
:authors
,
:categories
,
:categorizations
,
:comments
,
:tags
,
:taggings
,
:author_favorites
,
:vertices
,
:items
,
:books
,
fixtures
:posts
,
:authors
,
:categories
,
:categorizations
,
:comments
,
:tags
,
:taggings
,
:author_favorites
,
:vertices
,
:items
,
:books
,
# Reload edges table from fixtures as otherwise repeated test was failing
# Reload edges table from fixtures as otherwise repeated test was failing
...
...
activerecord/test/cases/associations/required_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
RequiredAssociationsTest
<
ActiveRecord
::
TestCase
class
RequiredAssociationsTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Parent
<
ActiveRecord
::
Base
class
Parent
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/autosave_association_test.rb
浏览文件 @
eaf38575
...
@@ -629,7 +629,7 @@ def test_autosave_new_record_with_after_create_callback
...
@@ -629,7 +629,7 @@ def test_autosave_new_record_with_after_create_callback
end
end
class
TestDestroyAsPartOfAutosaveAssociation
<
ActiveRecord
::
TestCase
class
TestDestroyAsPartOfAutosaveAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
@pirate
=
Pirate
.
create
(
:catchphrase
=>
"Don' botharrr talkin' like one, savvy?"
)
@pirate
=
Pirate
.
create
(
:catchphrase
=>
"Don' botharrr talkin' like one, savvy?"
)
...
@@ -637,7 +637,7 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase
...
@@ -637,7 +637,7 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase
end
end
teardown
do
teardown
do
# We are running without transactional
fixture
s and need to cleanup.
# We are running without transactional
test
s and need to cleanup.
Bird
.
delete_all
Bird
.
delete_all
Parrot
.
delete_all
Parrot
.
delete_all
@ship
.
delete
@ship
.
delete
...
@@ -1009,7 +1009,7 @@ def destroy(*args)
...
@@ -1009,7 +1009,7 @@ def destroy(*args)
end
end
class
TestAutosaveAssociationOnAHasOneAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationOnAHasOneAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1145,7 +1145,7 @@ def test_should_not_load_the_associated_model
...
@@ -1145,7 +1145,7 @@ def test_should_not_load_the_associated_model
end
end
class
TestAutosaveAssociationOnAHasOneThroughAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationOnAHasOneThroughAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1166,7 +1166,7 @@ def save(*args)
...
@@ -1166,7 +1166,7 @@ def save(*args)
end
end
class
TestAutosaveAssociationOnABelongsToAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationOnABelongsToAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1414,7 +1414,7 @@ def test_should_not_load_the_associated_models_if_they_were_not_loaded_yet
...
@@ -1414,7 +1414,7 @@ def test_should_not_load_the_associated_models_if_they_were_not_loaded_yet
end
end
class
TestAutosaveAssociationOnAHasManyAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationOnAHasManyAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1430,7 +1430,7 @@ def setup
...
@@ -1430,7 +1430,7 @@ def setup
end
end
class
TestAutosaveAssociationOnAHasAndBelongsToManyAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationOnAHasAndBelongsToManyAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1447,7 +1447,7 @@ def setup
...
@@ -1447,7 +1447,7 @@ def setup
end
end
class
TestAutosaveAssociationOnAHasAndBelongsToManyAssociationWithAcceptsNestedAttributes
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationOnAHasAndBelongsToManyAssociationWithAcceptsNestedAttributes
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1464,7 +1464,7 @@ def setup
...
@@ -1464,7 +1464,7 @@ def setup
end
end
class
TestAutosaveAssociationValidationsOnAHasManyAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationValidationsOnAHasManyAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1481,7 +1481,7 @@ def setup
...
@@ -1481,7 +1481,7 @@ def setup
end
end
class
TestAutosaveAssociationValidationsOnAHasOneAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationValidationsOnAHasOneAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1504,7 +1504,7 @@ def setup
...
@@ -1504,7 +1504,7 @@ def setup
end
end
class
TestAutosaveAssociationValidationsOnABelongsToAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationValidationsOnABelongsToAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1525,7 +1525,7 @@ def setup
...
@@ -1525,7 +1525,7 @@ def setup
end
end
class
TestAutosaveAssociationValidationsOnAHABTMAssociation
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationValidationsOnAHABTMAssociation
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
@@ -1548,7 +1548,7 @@ def setup
...
@@ -1548,7 +1548,7 @@ def setup
end
end
class
TestAutosaveAssociationValidationMethodsGeneration
<
ActiveRecord
::
TestCase
class
TestAutosaveAssociationValidationMethodsGeneration
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
super
super
...
...
activerecord/test/cases/date_time_precision_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
if
ActiveRecord
::
Base
.
connection
.
supports_datetime_with_precision?
if
ActiveRecord
::
Base
.
connection
.
supports_datetime_with_precision?
class
DateTimePrecisionTest
<
ActiveRecord
::
TestCase
class
DateTimePrecisionTest
<
ActiveRecord
::
TestCase
include
SchemaDumpingHelper
include
SchemaDumpingHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Foo
<
ActiveRecord
::
Base
;
end
class
Foo
<
ActiveRecord
::
Base
;
end
...
...
activerecord/test/cases/defaults_test.rb
浏览文件 @
eaf38575
...
@@ -90,14 +90,14 @@ def test_default_strings_containing_single_quotes
...
@@ -90,14 +90,14 @@ def test_default_strings_containing_single_quotes
if
current_adapter?
(
:MysqlAdapter
,
:Mysql2Adapter
)
if
current_adapter?
(
:MysqlAdapter
,
:Mysql2Adapter
)
class
DefaultsTestWithoutTransactionalFixtures
<
ActiveRecord
::
TestCase
class
DefaultsTestWithoutTransactionalFixtures
<
ActiveRecord
::
TestCase
# ActiveRecord::Base#create! (and #save and other related methods) will
# ActiveRecord::Base#create! (and #save and other related methods) will
# open a new transaction. When in transactional
fixture
s mode, this will
# open a new transaction. When in transactional
test
s mode, this will
# cause Active Record to create a new savepoint. However, since MySQL doesn't
# cause Active Record to create a new savepoint. However, since MySQL doesn't
# support DDL transactions, creating a table will result in any created
# support DDL transactions, creating a table will result in any created
# savepoints to be automatically released. This in turn causes the savepoint
# savepoints to be automatically released. This in turn causes the savepoint
# release code in AbstractAdapter#transaction to fail.
# release code in AbstractAdapter#transaction to fail.
#
#
# We don't want that to happen, so we disable transactional
fixture
s here.
# We don't want that to happen, so we disable transactional
test
s here.
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
using_strict
(
strict
)
def
using_strict
(
strict
)
connection
=
ActiveRecord
::
Base
.
remove_connection
connection
=
ActiveRecord
::
Base
.
remove_connection
...
...
activerecord/test/cases/disconnected_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@ class TestRecord < ActiveRecord::Base
...
@@ -4,7 +4,7 @@ class TestRecord < ActiveRecord::Base
end
end
class
TestDisconnectedAdapter
<
ActiveRecord
::
TestCase
class
TestDisconnectedAdapter
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
@connection
=
ActiveRecord
::
Base
.
connection
@connection
=
ActiveRecord
::
Base
.
connection
...
...
activerecord/test/cases/fixtures_test.rb
浏览文件 @
eaf38575
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
class
FixturesTest
<
ActiveRecord
::
TestCase
class
FixturesTest
<
ActiveRecord
::
TestCase
self
.
use_instantiated_fixtures
=
true
self
.
use_instantiated_fixtures
=
true
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
# other_topics fixture should not be included here
# other_topics fixture should not be included here
fixtures
:topics
,
:developers
,
:accounts
,
:tasks
,
:categories
,
:funny_jokes
,
:binaries
,
:traffic_lights
fixtures
:topics
,
:developers
,
:accounts
,
:tasks
,
:categories
,
:funny_jokes
,
:binaries
,
:traffic_lights
...
@@ -419,7 +419,7 @@ def test_without_instance_instantiation
...
@@ -419,7 +419,7 @@ def test_without_instance_instantiation
class
TransactionalFixturesTest
<
ActiveRecord
::
TestCase
class
TransactionalFixturesTest
<
ActiveRecord
::
TestCase
self
.
use_instantiated_fixtures
=
true
self
.
use_instantiated_fixtures
=
true
self
.
use_transactional_
fixture
s
=
true
self
.
use_transactional_
test
s
=
true
fixtures
:topics
fixtures
:topics
...
@@ -511,7 +511,7 @@ class CheckSetTableNameFixturesTest < ActiveRecord::TestCase
...
@@ -511,7 +511,7 @@ class CheckSetTableNameFixturesTest < ActiveRecord::TestCase
fixtures
:funny_jokes
fixtures
:funny_jokes
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# and thus takes into account our set_fixture_class
# and thus takes into account our set_fixture_class
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_table_method
def
test_table_method
assert_kind_of
Joke
,
funny_jokes
(
:a_joke
)
assert_kind_of
Joke
,
funny_jokes
(
:a_joke
)
...
@@ -523,7 +523,7 @@ class FixtureNameIsNotTableNameFixturesTest < ActiveRecord::TestCase
...
@@ -523,7 +523,7 @@ class FixtureNameIsNotTableNameFixturesTest < ActiveRecord::TestCase
fixtures
:items
fixtures
:items
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# and thus takes into account our set_fixture_class
# and thus takes into account our set_fixture_class
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_named_accessor
def
test_named_accessor
assert_kind_of
Book
,
items
(
:dvd
)
assert_kind_of
Book
,
items
(
:dvd
)
...
@@ -535,7 +535,7 @@ class FixtureNameIsNotTableNameMultipleFixturesTest < ActiveRecord::TestCase
...
@@ -535,7 +535,7 @@ class FixtureNameIsNotTableNameMultipleFixturesTest < ActiveRecord::TestCase
fixtures
:items
,
:funny_jokes
fixtures
:items
,
:funny_jokes
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# and thus takes into account our set_fixture_class
# and thus takes into account our set_fixture_class
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_named_accessor_of_differently_named_fixture
def
test_named_accessor_of_differently_named_fixture
assert_kind_of
Book
,
items
(
:dvd
)
assert_kind_of
Book
,
items
(
:dvd
)
...
@@ -549,7 +549,7 @@ def test_named_accessor_of_same_named_fixture
...
@@ -549,7 +549,7 @@ def test_named_accessor_of_same_named_fixture
class
CustomConnectionFixturesTest
<
ActiveRecord
::
TestCase
class
CustomConnectionFixturesTest
<
ActiveRecord
::
TestCase
set_fixture_class
:courses
=>
Course
set_fixture_class
:courses
=>
Course
fixtures
:courses
fixtures
:courses
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_leaky_destroy
def
test_leaky_destroy
assert_nothing_raised
{
courses
(
:ruby
)
}
assert_nothing_raised
{
courses
(
:ruby
)
}
...
@@ -564,7 +564,7 @@ def test_it_twice_in_whatever_order_to_check_for_fixture_leakage
...
@@ -564,7 +564,7 @@ def test_it_twice_in_whatever_order_to_check_for_fixture_leakage
class
TransactionalFixturesOnCustomConnectionTest
<
ActiveRecord
::
TestCase
class
TransactionalFixturesOnCustomConnectionTest
<
ActiveRecord
::
TestCase
set_fixture_class
:courses
=>
Course
set_fixture_class
:courses
=>
Course
fixtures
:courses
fixtures
:courses
self
.
use_transactional_
fixture
s
=
true
self
.
use_transactional_
test
s
=
true
def
test_leaky_destroy
def
test_leaky_destroy
assert_nothing_raised
{
courses
(
:ruby
)
}
assert_nothing_raised
{
courses
(
:ruby
)
}
...
@@ -580,7 +580,7 @@ class InvalidTableNameFixturesTest < ActiveRecord::TestCase
...
@@ -580,7 +580,7 @@ class InvalidTableNameFixturesTest < ActiveRecord::TestCase
fixtures
:funny_jokes
fixtures
:funny_jokes
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# and thus takes into account our lack of set_fixture_class
# and thus takes into account our lack of set_fixture_class
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_raises_error
def
test_raises_error
assert_raise
ActiveRecord
::
FixtureClassNotFound
do
assert_raise
ActiveRecord
::
FixtureClassNotFound
do
...
@@ -594,7 +594,7 @@ class CheckEscapedYamlFixturesTest < ActiveRecord::TestCase
...
@@ -594,7 +594,7 @@ class CheckEscapedYamlFixturesTest < ActiveRecord::TestCase
fixtures
:funny_jokes
fixtures
:funny_jokes
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# and thus takes into account our set_fixture_class
# and thus takes into account our set_fixture_class
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_proper_escaped_fixture
def
test_proper_escaped_fixture
assert_equal
"The
\\
n Aristocrats
\n
Ate the candy
\n
"
,
funny_jokes
(
:another_joke
).
name
assert_equal
"The
\\
n Aristocrats
\n
Ate the candy
\n
"
,
funny_jokes
(
:another_joke
).
name
...
@@ -664,7 +664,7 @@ def test_all_there
...
@@ -664,7 +664,7 @@ def test_all_there
end
end
class
FasterFixturesTest
<
ActiveRecord
::
TestCase
class
FasterFixturesTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
fixtures
:categories
,
:authors
fixtures
:categories
,
:authors
def
load_extra_fixture
(
name
)
def
load_extra_fixture
(
name
)
...
...
activerecord/test/cases/helper.rb
浏览文件 @
eaf38575
...
@@ -143,7 +143,7 @@ class ActiveSupport::TestCase
...
@@ -143,7 +143,7 @@ class ActiveSupport::TestCase
self
.
fixture_path
=
FIXTURES_ROOT
self
.
fixture_path
=
FIXTURES_ROOT
self
.
use_instantiated_fixtures
=
false
self
.
use_instantiated_fixtures
=
false
self
.
use_transactional_
fixture
s
=
true
self
.
use_transactional_
test
s
=
true
def
create_fixtures
(
*
fixture_set_names
,
&
block
)
def
create_fixtures
(
*
fixture_set_names
,
&
block
)
ActiveRecord
::
FixtureSet
.
create_fixtures
(
ActiveSupport
::
TestCase
.
fixture_path
,
fixture_set_names
,
fixture_class_names
,
&
block
)
ActiveRecord
::
FixtureSet
.
create_fixtures
(
ActiveSupport
::
TestCase
.
fixture_path
,
fixture_set_names
,
fixture_class_names
,
&
block
)
...
...
activerecord/test/cases/hot_compatibility_test.rb
浏览文件 @
eaf38575
require
'cases/helper'
require
'cases/helper'
class
HotCompatibilityTest
<
ActiveRecord
::
TestCase
class
HotCompatibilityTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
@klass
=
Class
.
new
(
ActiveRecord
::
Base
)
do
@klass
=
Class
.
new
(
ActiveRecord
::
Base
)
do
...
...
activerecord/test/cases/invalid_connection_test.rb
浏览文件 @
eaf38575
require
"cases/helper"
require
"cases/helper"
class
TestAdapterWithInvalidConnection
<
ActiveRecord
::
TestCase
class
TestAdapterWithInvalidConnection
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Bird
<
ActiveRecord
::
Base
class
Bird
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/locking_test.rb
浏览文件 @
eaf38575
...
@@ -285,10 +285,10 @@ def test_yaml_dumping_with_lock_column
...
@@ -285,10 +285,10 @@ def test_yaml_dumping_with_lock_column
class
OptimisticLockingWithSchemaChangeTest
<
ActiveRecord
::
TestCase
class
OptimisticLockingWithSchemaChangeTest
<
ActiveRecord
::
TestCase
fixtures
:people
,
:legacy_things
,
:references
fixtures
:people
,
:legacy_things
,
:references
# need to disable transactional
fixture
s, because otherwise the sqlite3
# need to disable transactional
test
s, because otherwise the sqlite3
# adapter (at least) chokes when we try and change the schema in the middle
# adapter (at least) chokes when we try and change the schema in the middle
# of a test (see test_increment_counter_*).
# of a test (see test_increment_counter_*).
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
{
:lock_version
=>
Person
,
:custom_lock_version
=>
LegacyThing
}.
each
do
|
name
,
model
|
{
:lock_version
=>
Person
,
:custom_lock_version
=>
LegacyThing
}.
each
do
|
name
,
model
|
define_method
(
"test_increment_counter_updates_
#{
name
}
"
)
do
define_method
(
"test_increment_counter_updates_
#{
name
}
"
)
do
...
@@ -365,7 +365,7 @@ def counter_test(model, expected_count)
...
@@ -365,7 +365,7 @@ def counter_test(model, expected_count)
# (See exec vs. async_exec in the PostgreSQL adapter.)
# (See exec vs. async_exec in the PostgreSQL adapter.)
unless
in_memory_db?
unless
in_memory_db?
class
PessimisticLockingTest
<
ActiveRecord
::
TestCase
class
PessimisticLockingTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
fixtures
:people
,
:readers
fixtures
:people
,
:readers
def
setup
def
setup
...
...
activerecord/test/cases/migration/change_schema_test.rb
浏览文件 @
eaf38575
...
@@ -426,7 +426,7 @@ def testing_table_with_only_foo_attribute
...
@@ -426,7 +426,7 @@ def testing_table_with_only_foo_attribute
if
ActiveRecord
::
Base
.
connection
.
supports_foreign_keys?
if
ActiveRecord
::
Base
.
connection
.
supports_foreign_keys?
class
ChangeSchemaWithDependentObjectsTest
<
ActiveRecord
::
TestCase
class
ChangeSchemaWithDependentObjectsTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
@connection
=
ActiveRecord
::
Base
.
connection
@connection
=
ActiveRecord
::
Base
.
connection
...
...
activerecord/test/cases/migration/column_attributes_test.rb
浏览文件 @
eaf38575
...
@@ -5,7 +5,7 @@ class Migration
...
@@ -5,7 +5,7 @@ class Migration
class
ColumnAttributesTest
<
ActiveRecord
::
TestCase
class
ColumnAttributesTest
<
ActiveRecord
::
TestCase
include
ActiveRecord
::
Migration
::
TestHelper
include
ActiveRecord
::
Migration
::
TestHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_add_column_newline_default
def
test_add_column_newline_default
string
=
"foo
\n
bar"
string
=
"foo
\n
bar"
...
...
activerecord/test/cases/migration/columns_test.rb
浏览文件 @
eaf38575
...
@@ -5,7 +5,7 @@ class Migration
...
@@ -5,7 +5,7 @@ class Migration
class
ColumnsTest
<
ActiveRecord
::
TestCase
class
ColumnsTest
<
ActiveRecord
::
TestCase
include
ActiveRecord
::
Migration
::
TestHelper
include
ActiveRecord
::
Migration
::
TestHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
# FIXME: this is more of an integration test with AR::Base and the
# FIXME: this is more of an integration test with AR::Base and the
# schema modifications. Maybe we should move this?
# schema modifications. Maybe we should move this?
...
...
activerecord/test/cases/migration/logger_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@ module ActiveRecord
...
@@ -4,7 +4,7 @@ module ActiveRecord
class
Migration
class
Migration
class
LoggerTest
<
ActiveRecord
::
TestCase
class
LoggerTest
<
ActiveRecord
::
TestCase
# MySQL can't roll back ddl changes
# MySQL can't roll back ddl changes
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
Migration
=
Struct
.
new
(
:name
,
:version
)
do
Migration
=
Struct
.
new
(
:name
,
:version
)
do
def
disable_ddl_transaction
;
false
end
def
disable_ddl_transaction
;
false
end
...
...
activerecord/test/cases/migration/references_statements_test.rb
浏览文件 @
eaf38575
...
@@ -5,7 +5,7 @@ class Migration
...
@@ -5,7 +5,7 @@ class Migration
class
ReferencesStatementsTest
<
ActiveRecord
::
TestCase
class
ReferencesStatementsTest
<
ActiveRecord
::
TestCase
include
ActiveRecord
::
Migration
::
TestHelper
include
ActiveRecord
::
Migration
::
TestHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
super
super
...
...
activerecord/test/cases/migration/rename_table_test.rb
浏览文件 @
eaf38575
...
@@ -5,7 +5,7 @@ class Migration
...
@@ -5,7 +5,7 @@ class Migration
class
RenameTableTest
<
ActiveRecord
::
TestCase
class
RenameTableTest
<
ActiveRecord
::
TestCase
include
ActiveRecord
::
Migration
::
TestHelper
include
ActiveRecord
::
Migration
::
TestHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
super
super
...
...
activerecord/test/cases/migration_test.rb
浏览文件 @
eaf38575
...
@@ -24,7 +24,7 @@ class Reminder < ActiveRecord::Base; end
...
@@ -24,7 +24,7 @@ class Reminder < ActiveRecord::Base; end
class
Thing
<
ActiveRecord
::
Base
;
end
class
Thing
<
ActiveRecord
::
Base
;
end
class
MigrationTest
<
ActiveRecord
::
TestCase
class
MigrationTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
fixtures
:people
fixtures
:people
...
...
activerecord/test/cases/migrator_test.rb
浏览文件 @
eaf38575
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require
"cases/migration/helper"
require
"cases/migration/helper"
class
MigratorTest
<
ActiveRecord
::
TestCase
class
MigratorTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
# Use this class to sense if migrations have gone
# Use this class to sense if migrations have gone
# up or down.
# up or down.
...
...
activerecord/test/cases/multiple_db_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
require
'models/course'
require
'models/course'
class
MultipleDbTest
<
ActiveRecord
::
TestCase
class
MultipleDbTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
@courses
=
create_fixtures
(
"courses"
)
{
Course
.
retrieve_connection
}
@courses
=
create_fixtures
(
"courses"
)
{
Course
.
retrieve_connection
}
...
...
activerecord/test/cases/nested_attributes_test.rb
浏览文件 @
eaf38575
...
@@ -943,7 +943,7 @@ def test_attr_accessor_of_child_should_be_value_provided_during_update
...
@@ -943,7 +943,7 @@ def test_attr_accessor_of_child_should_be_value_provided_during_update
end
end
class
TestHasOneAutosaveAssociationWhichItselfHasAutosaveAssociations
<
ActiveRecord
::
TestCase
class
TestHasOneAutosaveAssociationWhichItselfHasAutosaveAssociations
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
@pirate
=
Pirate
.
create!
(
:catchphrase
=>
"My baby takes tha mornin' train!"
)
@pirate
=
Pirate
.
create!
(
:catchphrase
=>
"My baby takes tha mornin' train!"
)
...
@@ -983,7 +983,7 @@ def setup
...
@@ -983,7 +983,7 @@ def setup
end
end
class
TestHasManyAutosaveAssociationWhichItselfHasAutosaveAssociations
<
ActiveRecord
::
TestCase
class
TestHasManyAutosaveAssociationWhichItselfHasAutosaveAssociations
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
unless
supports_savepoints?
self
.
use_transactional_
test
s
=
false
unless
supports_savepoints?
def
setup
def
setup
@ship
=
Ship
.
create!
(
:name
=>
"The good ship Dollypop"
)
@ship
=
Ship
.
create!
(
:name
=>
"The good ship Dollypop"
)
...
...
activerecord/test/cases/persistence_test.rb
浏览文件 @
eaf38575
...
@@ -898,7 +898,7 @@ def test_find_via_reload
...
@@ -898,7 +898,7 @@ def test_find_via_reload
end
end
class
SaveTest
<
ActiveRecord
::
TestCase
class
SaveTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_save_touch_false
def
test_save_touch_false
widget
=
Class
.
new
(
ActiveRecord
::
Base
)
do
widget
=
Class
.
new
(
ActiveRecord
::
Base
)
do
...
...
activerecord/test/cases/pooled_connections_test.rb
浏览文件 @
eaf38575
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
require
"timeout"
require
"timeout"
class
PooledConnectionsTest
<
ActiveRecord
::
TestCase
class
PooledConnectionsTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
@per_test_teardown
=
[]
@per_test_teardown
=
[]
...
...
activerecord/test/cases/primary_keys_test.rb
浏览文件 @
eaf38575
...
@@ -178,7 +178,7 @@ def test_primary_key_update_with_custom_key_name
...
@@ -178,7 +178,7 @@ def test_primary_key_update_with_custom_key_name
end
end
class
PrimaryKeyWithNoConnectionTest
<
ActiveRecord
::
TestCase
class
PrimaryKeyWithNoConnectionTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
unless
in_memory_db?
unless
in_memory_db?
def
test_set_primary_key_with_no_connection
def
test_set_primary_key_with_no_connection
...
@@ -199,7 +199,7 @@ def test_set_primary_key_with_no_connection
...
@@ -199,7 +199,7 @@ def test_set_primary_key_with_no_connection
class
PrimaryKeyAnyTypeTest
<
ActiveRecord
::
TestCase
class
PrimaryKeyAnyTypeTest
<
ActiveRecord
::
TestCase
include
SchemaDumpingHelper
include
SchemaDumpingHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Barcode
<
ActiveRecord
::
Base
class
Barcode
<
ActiveRecord
::
Base
end
end
...
@@ -229,7 +229,7 @@ def test_any_type_primary_key
...
@@ -229,7 +229,7 @@ def test_any_type_primary_key
if
current_adapter?
(
:MysqlAdapter
,
:Mysql2Adapter
)
if
current_adapter?
(
:MysqlAdapter
,
:Mysql2Adapter
)
class
PrimaryKeyWithAnsiQuotesTest
<
ActiveRecord
::
TestCase
class
PrimaryKeyWithAnsiQuotesTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
test_primary_key_method_with_ansi_quotes
def
test_primary_key_method_with_ansi_quotes
con
=
ActiveRecord
::
Base
.
connection
con
=
ActiveRecord
::
Base
.
connection
...
@@ -245,7 +245,7 @@ def test_primary_key_method_with_ansi_quotes
...
@@ -245,7 +245,7 @@ def test_primary_key_method_with_ansi_quotes
class
PrimaryKeyBigSerialTest
<
ActiveRecord
::
TestCase
class
PrimaryKeyBigSerialTest
<
ActiveRecord
::
TestCase
include
SchemaDumpingHelper
include
SchemaDumpingHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Widget
<
ActiveRecord
::
Base
class
Widget
<
ActiveRecord
::
Base
end
end
...
...
activerecord/test/cases/schema_dumper_test.rb
浏览文件 @
eaf38575
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
class
SchemaDumperTest
<
ActiveRecord
::
TestCase
class
SchemaDumperTest
<
ActiveRecord
::
TestCase
include
SchemaDumpingHelper
include
SchemaDumpingHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
setup
do
setup
do
ActiveRecord
::
SchemaMigration
.
create_table
ActiveRecord
::
SchemaMigration
.
create_table
...
...
activerecord/test/cases/test_fixtures_test.rb
0 → 100644
浏览文件 @
eaf38575
require
'cases/helper'
class
TestFixturesTest
<
ActiveRecord
::
TestCase
setup
do
@klass
=
Class
.
new
@klass
.
send
(
:include
,
ActiveRecord
::
TestFixtures
)
end
def
test_deprecated_use_transactional_fixtures
=
assert_deprecated
'use use_transactional_tests= instead'
do
@klass
.
use_transactional_fixtures
=
true
end
end
def
test_use_transactional_tests_prefers_use_transactional_fixtures
ActiveSupport
::
Deprecation
.
silence
do
@klass
.
use_transactional_fixtures
=
false
end
assert_equal
false
,
@klass
.
use_transactional_tests
end
def
test_use_transactional_tests_defaults_to_true
ActiveSupport
::
Deprecation
.
silence
do
@klass
.
use_transactional_fixtures
=
nil
end
assert_equal
true
,
@klass
.
use_transactional_tests
end
def
test_use_transactional_tests_can_be_overriden
@klass
.
use_transactional_tests
=
"foobar"
assert_equal
"foobar"
,
@klass
.
use_transactional_tests
end
end
activerecord/test/cases/time_precision_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
if
ActiveRecord
::
Base
.
connection
.
supports_datetime_with_precision?
if
ActiveRecord
::
Base
.
connection
.
supports_datetime_with_precision?
class
TimePrecisionTest
<
ActiveRecord
::
TestCase
class
TimePrecisionTest
<
ActiveRecord
::
TestCase
include
SchemaDumpingHelper
include
SchemaDumpingHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Foo
<
ActiveRecord
::
Base
;
end
class
Foo
<
ActiveRecord
::
Base
;
end
...
...
activerecord/test/cases/timestamp_test.rb
浏览文件 @
eaf38575
...
@@ -450,7 +450,7 @@ def test_all_timestamp_attributes_in_model
...
@@ -450,7 +450,7 @@ def test_all_timestamp_attributes_in_model
class
TimestampsWithoutTransactionTest
<
ActiveRecord
::
TestCase
class
TimestampsWithoutTransactionTest
<
ActiveRecord
::
TestCase
include
DdlHelper
include
DdlHelper
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
TimestampAttributePost
<
ActiveRecord
::
Base
class
TimestampAttributePost
<
ActiveRecord
::
Base
attr_accessor
:created_at
,
:updated_at
attr_accessor
:created_at
,
:updated_at
...
...
activerecord/test/cases/transaction_callbacks_test.rb
浏览文件 @
eaf38575
...
@@ -367,7 +367,7 @@ def add_transaction_execution_blocks(record)
...
@@ -367,7 +367,7 @@ def add_transaction_execution_blocks(record)
end
end
class
CallbacksOnMultipleActionsTest
<
ActiveRecord
::
TestCase
class
CallbacksOnMultipleActionsTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
TopicWithCallbacksOnMultipleActions
<
ActiveRecord
::
Base
class
TopicWithCallbacksOnMultipleActions
<
ActiveRecord
::
Base
self
.
table_name
=
:topics
self
.
table_name
=
:topics
...
...
activerecord/test/cases/transaction_isolation_test.rb
浏览文件 @
eaf38575
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
unless
ActiveRecord
::
Base
.
connection
.
supports_transaction_isolation?
unless
ActiveRecord
::
Base
.
connection
.
supports_transaction_isolation?
class
TransactionIsolationUnsupportedTest
<
ActiveRecord
::
TestCase
class
TransactionIsolationUnsupportedTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Tag
<
ActiveRecord
::
Base
class
Tag
<
ActiveRecord
::
Base
end
end
...
@@ -17,7 +17,7 @@ class Tag < ActiveRecord::Base
...
@@ -17,7 +17,7 @@ class Tag < ActiveRecord::Base
if
ActiveRecord
::
Base
.
connection
.
supports_transaction_isolation?
if
ActiveRecord
::
Base
.
connection
.
supports_transaction_isolation?
class
TransactionIsolationTest
<
ActiveRecord
::
TestCase
class
TransactionIsolationTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
class
Tag
<
ActiveRecord
::
Base
class
Tag
<
ActiveRecord
::
Base
self
.
table_name
=
'tags'
self
.
table_name
=
'tags'
...
...
activerecord/test/cases/transactions_test.rb
浏览文件 @
eaf38575
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
require
'models/movie'
require
'models/movie'
class
TransactionTest
<
ActiveRecord
::
TestCase
class
TransactionTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
fixtures
:topics
,
:developers
,
:authors
,
:posts
fixtures
:topics
,
:developers
,
:authors
,
:posts
def
setup
def
setup
...
@@ -703,7 +703,7 @@ def test_transaction_rollback_with_primarykeyless_tables
...
@@ -703,7 +703,7 @@ def test_transaction_rollback_with_primarykeyless_tables
end
end
class
TransactionsWithTransactionalFixturesTest
<
ActiveRecord
::
TestCase
class
TransactionsWithTransactionalFixturesTest
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
true
self
.
use_transactional_
test
s
=
true
fixtures
:topics
fixtures
:topics
def
test_automatic_savepoint_in_outer_transaction
def
test_automatic_savepoint_in_outer_transaction
...
...
activerecord/test/cases/unconnected_test.rb
浏览文件 @
eaf38575
...
@@ -4,7 +4,7 @@ class TestRecord < ActiveRecord::Base
...
@@ -4,7 +4,7 @@ class TestRecord < ActiveRecord::Base
end
end
class
TestUnconnectedAdapter
<
ActiveRecord
::
TestCase
class
TestUnconnectedAdapter
<
ActiveRecord
::
TestCase
self
.
use_transactional_
fixture
s
=
false
self
.
use_transactional_
test
s
=
false
def
setup
def
setup
@underlying
=
ActiveRecord
::
Base
.
connection
@underlying
=
ActiveRecord
::
Base
.
connection
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录