initial-test-data 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f858811a806c2fc042d1396bd6390e4c05e2e6dc
4
- data.tar.gz: 900a063128080d53afbbf8238b6deb959816dc7e
3
+ metadata.gz: 934b819f0326ca51b103547bd4ba930e3bd89de3
4
+ data.tar.gz: 12e3d2844061909c2ef2daf66896165f6321d150
5
5
  SHA512:
6
- metadata.gz: 586696349dc870ea98209f3a5a7da6eb4f48abe7910b3814e71738c28d510c51a0442b62e51c7c5c37f64869a6d2a2243c1c4a28ed6a5c9ceaa1b8c5f3e8060e
7
- data.tar.gz: e247db303eb1b98f9e2d8adccf07534b6e4deddcfe5d4031a4e7187d4868f94d9b67ecfe8cb76ab70f44a9c49113655b2424ac19182308187d704a12be079506
6
+ metadata.gz: 656ca06fb2500176fb96dd6196b83ffea236a59b92b1d2c5a56e3a0b22224816c92459c2f1bf7b45f924dae488a6c00393642021c0e9851f26695087e8582a81
7
+ data.tar.gz: 530bfdaa4ef45c84a331483f3cf25f8459335e134986f82fbc6e47db84771479b27089b6ca4bd188de288b881f4c1fff55399e0a2315c3730e1c06b8acfb2553
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG - initial-test-data
2
2
 
3
+ ## 0.4.1 (February 2, 2016)
4
+
5
+ * Add `as` option to the `store` utility method.
6
+
3
7
  ## 0.4.0 (February 1, 2016)
4
8
 
5
9
  * Introduce utility methods `store` and `fetch`.
data/README.md CHANGED
@@ -116,7 +116,21 @@ RSpec.configure do |config|
116
116
  end
117
117
  ```
118
118
 
119
- This option is passed to the `DatabaseCleaner.strategy=` method.
119
+ #### `only`
120
+
121
+ Contrary to the `except` option, when you use this,
122
+ only the specified tables are initialized:
123
+
124
+ ```ruby
125
+ RSpec.configure do |config|
126
+ config.before(:suite) do
127
+ InitialTestData.load('spec', only: %w(customers products))
128
+ end
129
+ end
130
+ ```
131
+
132
+ Note that the `except` and `only` options are used to construct
133
+ the options passed to the `DatabaseCleaner.strategy=` method.
120
134
 
121
135
  #### `monitoring`
122
136
 
@@ -248,3 +262,13 @@ feature 'Manage customers' do
248
262
  end
249
263
  end
250
264
  ```
265
+
266
+ License
267
+ -------
268
+
269
+ The `initial-test-data` is distributed under the MIT license. ([MIT-LICENSE](https://github.com/oiax/initial-test-data/blob/master/MIT-LICENSE))
270
+
271
+ Author
272
+ ------
273
+
274
+ Tsutomu Kuroda (t-kuroda@oiax.jp)
@@ -2,8 +2,8 @@ require 'active_support'
2
2
 
3
3
  module InitialTestData
4
4
  module Utilities
5
- def store(record, name)
6
- model_name = record.class.model_name.singular
5
+ def store(record, name, options = {})
6
+ model_name = options[:as] || record.class.model_name.singular
7
7
  record_name = name.to_s
8
8
 
9
9
  RECORD_IDS[model_name] ||= HashWithIndifferentAccess.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: initial-test-data
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
  - Tsutomu KURODA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport