initial-test-data 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +17 -0
- data/lib/initial-test-data/initial_test_data.rb +4 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e71815d11df0137cc431aa647a0206f349d8b139
|
4
|
+
data.tar.gz: c5ed391b3f9397eb2e3a4ece4080e5313da7323c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d74ef5c2c47b518f555bc7e49873053a075de03dc0d2714661f5706f058b7c2f4e3e8673455e158c8e4579e2c6c62e79263df34c232250f2ab9ee3aa1d83557a
|
7
|
+
data.tar.gz: 5bd974fabef2f8bdf51cb24fe6f2ec3cd6bcd08dd575eebbef4c1359ef97d31961ae058fb58532fae845fb225f832a6552bd3679165038ac1e97f7f109e09f32
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# CHANGELOG - initial-test-data
|
2
|
+
|
3
|
+
## 0.2.0 (January 31, 2016)
|
4
|
+
|
5
|
+
* The class method `InitialTestData.load` treats the last hash argument
|
6
|
+
as the options for `DatabaseCleaner.strategy=` method.
|
7
|
+
|
8
|
+
## 0.1.0 (January 31, 2016)
|
9
|
+
|
10
|
+
* The first release with minimum functionalities.
|
data/README.md
CHANGED
@@ -79,6 +79,23 @@ which has a content like this:
|
|
79
79
|
- orders
|
80
80
|
```
|
81
81
|
|
82
|
+
### Database Cleaner
|
83
|
+
|
84
|
+
The `initial-test-data` utilizes the `database_cleaner` gem to truncate
|
85
|
+
all tables except `_initial_data_digest` and `schema_migrations`.
|
86
|
+
|
87
|
+
If you want to keep some tables intact, specify the `except` option:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
RSpec.configure do |config|
|
91
|
+
config.before(:suite) do
|
92
|
+
InitialTestData.load('spec', except: %w(country_names))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
This option is passed to the `DatabaseCleaner.strategy=` method.
|
98
|
+
|
82
99
|
Example
|
83
100
|
-------
|
84
101
|
|
@@ -5,8 +5,9 @@ class InitialTestData
|
|
5
5
|
DIGEST_TABLE_NAME = '_initial_data_digest'
|
6
6
|
|
7
7
|
class << self
|
8
|
-
def load(
|
9
|
-
@
|
8
|
+
def load(*args)
|
9
|
+
@database_cleaner_strategy_options = args.extract_options!
|
10
|
+
@dir = args[0] || 'test'
|
10
11
|
|
11
12
|
klass = define_class
|
12
13
|
|
@@ -48,7 +49,7 @@ class InitialTestData
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def initialize_data
|
51
|
-
DatabaseCleaner.strategy = :truncation
|
52
|
+
DatabaseCleaner.strategy = :truncation, @database_cleaner_strategy_options
|
52
53
|
DatabaseCleaner.clean
|
53
54
|
|
54
55
|
yaml_path = Rails.root.join(@dir, 'initial_data', '_index.yml')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: initial-test-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsutomu KURODA
|
@@ -31,6 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- CHANGELOG.md
|
34
35
|
- MIT-LICENSE
|
35
36
|
- README.md
|
36
37
|
- lib/initial-test-data.rb
|