transactional-factories 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +11 -0
- data/VERSION +1 -1
- data/lib/transactional_factories/test_suite.rb +3 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -30,6 +30,17 @@ transactional-factories provides self.setup and self.teardown callbacks that are
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
=== Multiple Database Connections
|
34
|
+
|
35
|
+
If you have an application that connects to multiple databases, you will need to tell transactional-factories which connection to use when creating a transaction. This is done at with another class-level callback: TestCase.transaction_class. E.g.,
|
36
|
+
|
37
|
+
class MyModelTest < Test::Unit::TestCase
|
38
|
+
def self.transaction_class
|
39
|
+
# Default is ActiveRecord::Base
|
40
|
+
ModelWithDifferentDatabaseConnection
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
33
44
|
=== Dependencies
|
34
45
|
|
35
46
|
<b>nested transactional db</b> - You must be using a database that supports nested transactions or savepoints. I've only tested on MySQL. Would be nice to have someone confirm this on PostgreSQL.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -10,13 +10,14 @@ module TransactionalFactories
|
|
10
10
|
raise TransactionalFixturesEnabled, 'transactional-factories does not work with transactional fixtures. Please set use_transactional_fixtures = false.'
|
11
11
|
end
|
12
12
|
end
|
13
|
+
transaction_class = testcase.class.respond_to?(:transaction_class) ? testcase.class.transaction_class : ActiveRecord::Base
|
13
14
|
if @tests.any? { |testcase| testcase.method_name != 'default_test' }
|
14
|
-
|
15
|
+
transaction_class.transaction(:requires_new => true) do
|
15
16
|
testcase.class.setup if testcase
|
16
17
|
begin
|
17
18
|
yield(STARTED, name)
|
18
19
|
@tests.each do |test|
|
19
|
-
|
20
|
+
transaction_class.transaction(:requires_new => true) do
|
20
21
|
test.run(result, &progress_block)
|
21
22
|
raise ActiveRecord::Rollback
|
22
23
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 4
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrew Carpenter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-29 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|