transactional-factories 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. data/README.rdoc +15 -11
  2. data/Rakefile +3 -2
  3. data/VERSION +1 -1
  4. metadata +14 -4
data/README.rdoc CHANGED
@@ -8,21 +8,25 @@ transactional-factories provides self.setup and self.teardown callbacks that are
8
8
 
9
9
  require 'transactional_factories'
10
10
 
11
- class MyTest < Test::Unit::TestCase
11
+ class MyModelTest < Test::Unit::TestCase
12
+ # Class method setup is called only once to create test data.
12
13
  def self.setup
13
14
  100.times { MyModel.create }
14
15
  end
15
-
16
- def test_my_model_1
17
- assert_equal 100, MyModel.create
16
+
17
+ # Instance method setup is called before each test method (usual ruby behavior).
18
+ def setup
18
19
  MyModel.create
19
- assert_equal 101, MyModel.create
20
20
  end
21
-
22
- def test_my_model_2
23
- assert_equal 100, MyModel.create
24
- MyModel.create
25
- assert_equal 101, MyModel.create
21
+
22
+ def test_1
23
+ assert_equal 101, MyModel.count
24
+ MyModel.delete_all
25
+ assert_equal 0, MyModel.count
26
+ end
27
+
28
+ def test_2
29
+ assert_equal 101, MyModel.count
26
30
  end
27
31
  end
28
32
 
@@ -32,7 +36,7 @@ transactional-factories provides self.setup and self.teardown callbacks that are
32
36
 
33
37
  <b>>= ActiveRecord 2.3.x</b> - I don't think ActiveRecord supported nested transactions until 2.3.x.
34
38
 
35
- <b>use_transactional_fixtures = false</b> - Your test cases can not use transactional fixtures. They're doing about the same thing that the transactional-factories gem is doing and they stomp on each other.
39
+ <b>use_transactional_fixtures = false</b> - Your test cases can not use ActiveRecord transactional fixtures. Transactional fixtures wrap each test method in a transaction in such a way that does not allow nesting. Boo!
36
40
 
37
41
  If you get this: TransactionalFactories::TransactionalFixturesEnabled, it's time to disable transactional fixtures doing something like this:
38
42
 
data/Rakefile CHANGED
@@ -5,11 +5,12 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "transactional-factories"
8
- gem.summary = "Using nested-transactions to initialize test data programmatically."
9
- gem.description = "Transactional-factories uses nested-transactions (like transactional fixtures) to allow efficient initialization of test data programmatically (unlike transactional fixtures)."
8
+ gem.summary = "Using nested-transactions to allow efficient, programmatic initialization of test data"
9
+ gem.description = gem.summary
10
10
  gem.email = "tim.harrison@yahoo.com"
11
11
  gem.homepage = "http://github.com/heedspin/transactional-factories"
12
12
  gem.authors = ["Tim Harrison"]
13
+ gem.add_dependency('activesupport', '>= 2.3.2')
13
14
  gem.add_dependency('activerecord', '>= 2.3.2')
14
15
  gem.files.exclude '.gitignore'
15
16
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transactional-factories
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Harrison
@@ -9,9 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-31 00:00:00 -08:00
12
+ date: 2010-01-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.2
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: activerecord
17
27
  type: :runtime
@@ -22,7 +32,7 @@ dependencies:
22
32
  - !ruby/object:Gem::Version
23
33
  version: 2.3.2
24
34
  version:
25
- description: Transactional-factories uses nested-transactions (like transactional fixtures) to allow efficient initialization of test data programmatically (unlike transactional fixtures).
35
+ description: Using nested-transactions to allow efficient, programmatic initialization of test data
26
36
  email: tim.harrison@yahoo.com
27
37
  executables: []
28
38
 
@@ -68,7 +78,7 @@ rubyforge_project:
68
78
  rubygems_version: 1.3.5
69
79
  signing_key:
70
80
  specification_version: 3
71
- summary: Using nested-transactions to initialize test data programmatically.
81
+ summary: Using nested-transactions to allow efficient, programmatic initialization of test data
72
82
  test_files:
73
83
  - test/db/schema.rb
74
84
  - test/lib/blog_post.rb