myronmarston-factory_data_preloader 0.4.0 → 0.4.1

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 (3) hide show
  1. data/README.rdoc +27 -0
  2. data/VERSION.yml +1 -1
  3. metadata +1 -1
data/README.rdoc CHANGED
@@ -55,6 +55,7 @@ Define your data in these files like this:
55
55
 
56
56
  Finally, use this preloaded data in your tests:
57
57
 
58
+ # test/user_test.rb
58
59
  class UserTest < ActiveSupport::TestCase
59
60
  def test_thom_has_last_name
60
61
  user = FactoryData.users(:thom)
@@ -62,6 +63,32 @@ Finally, use this preloaded data in your tests:
62
63
  end
63
64
  end
64
65
 
66
+ # test/post_test.rb
67
+ class PostTest < ActiveSupport::TestCase
68
+ def test_post_has_body
69
+ post = FactoryData.posts(:tour)
70
+ assert_not_nil post.body
71
+ end
72
+ end
73
+
74
+ All factory data is automatically preloaded for all tests. In a large rails application, this can incur a significant performance penalty
75
+ at the start of each test run. If you want finer grain control over which preloaders run, you can configure it like so:
76
+
77
+ # in test_helper.rb
78
+ FactoryDataPreloader.preload_all = false
79
+
80
+ # test/user_test.rb
81
+ class UserTest < ActiveSupport::TestCase
82
+ preload_factory_data :users # multiple types can be listed as necessary
83
+ # test go here...
84
+ end
85
+
86
+ # test/post_test.rb
87
+ class PostTest < ActiveSupport::TestCase
88
+ preload_factory_data :posts # dependencies are taken into account, so users will automatically be preloaded as well.
89
+ # test go here...
90
+ end
91
+
65
92
  == Notes, etc.
66
93
 
67
94
  * This gem has been tested with Rails 2.2.2 and Rails 2.3.2.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 0
4
+ :patch: 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myronmarston-factory_data_preloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston