transactionata 0.1.0 → 0.2.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/.gitignore +1 -0
- data/README.rdoc +8 -4
- data/lib/transactionata/version.rb +1 -1
- data/lib/transactionata.rb +2 -1
- metadata +4 -16
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
@@ -14,6 +14,7 @@ not leverage this for your Factory-built test data as well? Transactionata allow
|
|
14
14
|
class UserTest < ActiveSupport::TestCase
|
15
15
|
test_data do
|
16
16
|
Factory.create(:user, :login => 'colszowka')
|
17
|
+
# super-complex, time consuming, web-service-hooked-up test data setup continues
|
17
18
|
end
|
18
19
|
|
19
20
|
should "destroy a User" do
|
@@ -28,13 +29,13 @@ not leverage this for your Factory-built test data as well? Transactionata allow
|
|
28
29
|
subject { @user ||= User.find_by_login!('colszowka') }
|
29
30
|
|
30
31
|
should "not be a new record" do
|
31
|
-
assert
|
32
|
+
assert !subject.new_record?
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
This will run the code block given to test_data
|
37
|
-
|
37
|
+
This will run the code block given to test_data alongside Fixtures and therefore 'protect' your data using Rails
|
38
|
+
built-in fixture transactions, giving you huge performance gains if you're using factories a lot.
|
38
39
|
|
39
40
|
For the (FactoryGirl/Shoulda-heavy) Ruby Toolbox 2 test suite, the time for a complete test run went from 5 minutes
|
40
41
|
to 50 seconds by just moving test data generation into centralized blocks for each test case using Transactionata.
|
@@ -51,9 +52,12 @@ in the setup/subject blocks.
|
|
51
52
|
Of course, all of this is completely applicable to default Ruby/Rails unit tests, you don't have to use Shoulda for
|
52
53
|
transactional data setup to work.
|
53
54
|
|
55
|
+
Please note that you'll have to have fixture files for the models you're using transactionata for. They can be empty,
|
56
|
+
but they have to be in place so Rails' Fixture loading mechanism will purge the database tables between multiple test cases.
|
57
|
+
|
54
58
|
== Compatibility
|
55
59
|
|
56
|
-
Transactionata's test suite runs against Rails 2.3.10 and 3.0.4 on Ruby 1.9.2, 1.8.7 and REE. Since no black magic is
|
60
|
+
Transactionata's test suite currently runs against Rails 2.3.10 and 3.0.4 on Ruby 1.9.2, 1.8.7 and REE. Since no black magic is
|
57
61
|
involved, it should work on other platforms and versions as well.
|
58
62
|
|
59
63
|
|
data/lib/transactionata.rb
CHANGED
@@ -23,8 +23,9 @@ module Transactionata
|
|
23
23
|
attr_accessor :test_data_block
|
24
24
|
end
|
25
25
|
|
26
|
+
alias_method :original_load_fixtures, :load_fixtures
|
26
27
|
def load_fixtures
|
27
|
-
|
28
|
+
original_load_fixtures
|
28
29
|
self.class.test_data_block.call
|
29
30
|
Fixtures.reset_cache # Required to enforce purging tables for every test file
|
30
31
|
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transactionata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Christoph Olszowka
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-03-30 00:00:00 +02:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
24
|
version: "0"
|
31
25
|
type: :development
|
32
26
|
version_requirements: *id001
|
@@ -38,8 +32,6 @@ dependencies:
|
|
38
32
|
requirements:
|
39
33
|
- - ">="
|
40
34
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
35
|
version: "0"
|
44
36
|
type: :development
|
45
37
|
version_requirements: *id002
|
@@ -185,21 +177,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
177
|
requirements:
|
186
178
|
- - ">="
|
187
179
|
- !ruby/object:Gem::Version
|
188
|
-
segments:
|
189
|
-
- 0
|
190
180
|
version: "0"
|
191
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
182
|
none: false
|
193
183
|
requirements:
|
194
184
|
- - ">="
|
195
185
|
- !ruby/object:Gem::Version
|
196
|
-
segments:
|
197
|
-
- 0
|
198
186
|
version: "0"
|
199
187
|
requirements: []
|
200
188
|
|
201
189
|
rubyforge_project: transactionata
|
202
|
-
rubygems_version: 1.3
|
190
|
+
rubygems_version: 1.5.3
|
203
191
|
signing_key:
|
204
192
|
specification_version: 3
|
205
193
|
summary: "Transactionata: Transactional dynamic test data for Rails Tests. Set up your models and factories in a block that will be executed once and then rolled back by hooking into ActiveRecord's built-in fixture transactions"
|