test_data 0.3.1 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4178759cb111f2f83cad983712c1b82220aa09ecdbd7d710b7517974c63fee8c
4
- data.tar.gz: dc83bc5526b88239ba2d55661a8ab61865a7a8d19f8c195d2caa41e00125b7e5
3
+ metadata.gz: 07a33524dae4dd0de877d4a7abdbc549a2dfc44d3c7c2135bfb926fe06fa598f
4
+ data.tar.gz: 6dcb4cec0013f726fb45f1eafb1c813571d6c7816f3e2999560d8108d665d8e6
5
5
  SHA512:
6
- metadata.gz: 7aba197cb61bff3286913de3678a6df0f4595774bb7283228de6e26ae64fb03586e8233362bf9cea3ef041cc1e53a539a323e3c5d59fb6d16470f6db904402e5
7
- data.tar.gz: bc49d93f8dc68d09612ba36220dd7f380a2f8cc4657f968dc9a8220d96f07532c912f119fed9e2d25ba0840b9480f82a12954ea30a54bd1c1fe357bea8920154
6
+ metadata.gz: fe32388d16a613e3275b55359a8921366bafb4c0b7093298f9745acb94a61649e1b016fde7e78eb82b285a3aa002be3234e687302f8ff43e517737904b8f4891
7
+ data.tar.gz: 44889012a9b055e09c50328c163d3632e4d048578baa41d6218c1e38fe9952d87efa5d9d4c505ae6bdd09bb887189e21005eb64cfd9b8e2d85b1ebd5ca29a1a9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.3.2
2
+
3
+ - Improve the flexibility of the webpacker config generator
4
+ - Improve failure output when an error is raised during rake tests that fork
5
+ into a `test_data` env
6
+
1
7
  # 0.3.1
2
8
 
3
9
  - Loosen railties dependencies after verifying basic Rails 7 support
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- test_data (0.3.1)
4
+ test_data (0.4.0)
5
5
  railties (>= 6.0, < 8.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (7.0.2.3)
11
- actionview (= 7.0.2.3)
12
- activesupport (= 7.0.2.3)
10
+ actionpack (7.0.4)
11
+ actionview (= 7.0.4)
12
+ activesupport (= 7.0.4)
13
13
  rack (~> 2.0, >= 2.2.0)
14
14
  rack-test (>= 0.6.3)
15
15
  rails-dom-testing (~> 2.0)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (7.0.2.3)
18
- activesupport (= 7.0.2.3)
17
+ actionview (7.0.4)
18
+ activesupport (= 7.0.4)
19
19
  builder (~> 3.1)
20
20
  erubi (~> 1.4)
21
21
  rails-dom-testing (~> 2.0)
22
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activesupport (7.0.2.3)
23
+ activesupport (7.0.4)
24
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
25
25
  i18n (>= 1.6, < 2)
26
26
  minitest (>= 5.1)
@@ -30,67 +30,69 @@ GEM
30
30
  coderay (1.1.3)
31
31
  concurrent-ruby (1.1.10)
32
32
  crass (1.0.6)
33
- erubi (1.10.0)
34
- i18n (1.10.0)
33
+ erubi (1.11.0)
34
+ i18n (1.12.0)
35
35
  concurrent-ruby (~> 1.0)
36
- loofah (2.15.0)
36
+ json (2.6.2)
37
+ loofah (2.19.0)
37
38
  crass (~> 1.0.2)
38
39
  nokogiri (>= 1.5.9)
39
40
  method_source (1.0.0)
40
41
  mini_portile2 (2.8.0)
41
- minitest (5.15.0)
42
- nokogiri (1.13.3)
42
+ minitest (5.16.3)
43
+ nokogiri (1.13.9)
43
44
  mini_portile2 (~> 2.8.0)
44
45
  racc (~> 1.4)
45
46
  parallel (1.22.1)
46
- parser (3.1.1.0)
47
+ parser (3.1.2.1)
47
48
  ast (~> 2.4.1)
48
49
  pry (0.14.1)
49
50
  coderay (~> 1.1)
50
51
  method_source (~> 1.0)
51
52
  racc (1.6.0)
52
- rack (2.2.3)
53
- rack-test (1.1.0)
54
- rack (>= 1.0, < 3)
53
+ rack (2.2.4)
54
+ rack-test (2.0.2)
55
+ rack (>= 1.3)
55
56
  rails-dom-testing (2.0.3)
56
57
  activesupport (>= 4.2.0)
57
58
  nokogiri (>= 1.6)
58
- rails-html-sanitizer (1.4.2)
59
+ rails-html-sanitizer (1.4.3)
59
60
  loofah (~> 2.3)
60
- railties (7.0.2.3)
61
- actionpack (= 7.0.2.3)
62
- activesupport (= 7.0.2.3)
61
+ railties (7.0.4)
62
+ actionpack (= 7.0.4)
63
+ activesupport (= 7.0.4)
63
64
  method_source
64
65
  rake (>= 12.2)
65
66
  thor (~> 1.0)
66
67
  zeitwerk (~> 2.5)
67
68
  rainbow (3.1.1)
68
69
  rake (13.0.6)
69
- regexp_parser (2.2.1)
70
+ regexp_parser (2.6.0)
70
71
  rexml (3.2.5)
71
- rubocop (1.26.0)
72
+ rubocop (1.35.1)
73
+ json (~> 2.3)
72
74
  parallel (~> 1.10)
73
- parser (>= 3.1.0.0)
75
+ parser (>= 3.1.2.1)
74
76
  rainbow (>= 2.2.2, < 4.0)
75
77
  regexp_parser (>= 1.8, < 3.0)
76
- rexml
77
- rubocop-ast (>= 1.16.0, < 2.0)
78
+ rexml (>= 3.2.5, < 4.0)
79
+ rubocop-ast (>= 1.20.1, < 2.0)
78
80
  ruby-progressbar (~> 1.7)
79
81
  unicode-display_width (>= 1.4.0, < 3.0)
80
- rubocop-ast (1.16.0)
82
+ rubocop-ast (1.23.0)
81
83
  parser (>= 3.1.1.0)
82
- rubocop-performance (1.13.3)
84
+ rubocop-performance (1.14.3)
83
85
  rubocop (>= 1.7.0, < 2.0)
84
86
  rubocop-ast (>= 0.4.0)
85
87
  ruby-progressbar (1.11.0)
86
- standard (1.9.0)
87
- rubocop (= 1.26.0)
88
- rubocop-performance (= 1.13.3)
88
+ standard (1.16.1)
89
+ rubocop (= 1.35.1)
90
+ rubocop-performance (= 1.14.3)
89
91
  thor (1.2.1)
90
- tzinfo (2.0.4)
92
+ tzinfo (2.0.5)
91
93
  concurrent-ruby (~> 1.0)
92
- unicode-display_width (2.1.0)
93
- zeitwerk (2.5.4)
94
+ unicode-display_width (2.3.0)
95
+ zeitwerk (2.6.6)
94
96
 
95
97
  PLATFORMS
96
98
  ruby
data/README.md CHANGED
@@ -1,3 +1,10 @@
1
+ # ⛔ DEPRECATED ⛔
2
+
3
+ test_data is deprecated and unmaintained.
4
+
5
+ We have no plans to hand off the package or resurrect it, but you are of course
6
+ welcome to fork it.
7
+
1
8
  # The `test_data` gem
2
9
 
3
10
  `test_data` does what it says on the tin: it provides a fast & reliable system
@@ -19,8 +26,8 @@ What it does:
19
26
  app**
20
27
 
21
28
  * Exposes a simple API for ensuring that your data will be pristine for each of
22
- your tests, whether the test depends on test_data, an empty database, or Rails
23
- fixtures
29
+ your tests, whether the test depends on test_data, factories, fixtures, or an
30
+ empty database
24
31
 
25
32
  * Safeguards your tests from flaky failures and supercharges your build by
26
33
  providing a sophisticated transaction manager that isolates each test while
@@ -41,11 +48,11 @@ are required**—so it may not work for every project just yet.]_
41
48
 
42
49
  This gem requires a lot of documentation—not because `test_data` does a lot of
43
50
  things, but because managing one's test data is an inherently complex task. If
44
- one reason Rails apps chronically suffer from slow tests is that other
45
- approaches oversimplify test data management, it stands to reason that any
46
- discomfort caused by `test_data`'s scope may not be _unnecessary complexity_ but
47
- instead be an indication of how little of the problem's _essential complexity_
48
- we have reckoned with to this point.
51
+ there's one reason Rails apps often suffer from slow tests, it's that the most
52
+ popular approaches to test data management oversimplify the problem—they might
53
+ save time up front, but tend to cost you later. The `test_data` gem, meanwhile,
54
+ is designed to tackle the problem head on: it takes longer to set up, but it'll
55
+ scale along with your application for years to come.
49
56
 
50
57
  1. [Getting Started Guide](#getting-started-guide)
51
58
  1. [Install and initialize `test_data`](#step-1-install-and-initialize-test_data)
@@ -106,22 +113,42 @@ And if you get stuck or need help as you're getting started, please feel free to
106
113
 
107
114
  ### Step 1: Install and initialize `test_data`
108
115
 
109
- #### Adding the gem
116
+ #### Adding a `:test_data` group to your Gemfile
110
117
 
111
- First, add `test_data` to your Gemfile. Either include it in all groups or add
112
- it to the `:development`, `:test`, and (the all new!) `:test_data` gem groups:
118
+ Before even installing anything, it's important to understand that because
119
+ `test_data` defines a new Rails environment and because Rails expects
120
+ a gem group (like `:development`, `:test`, and `:production`) for each
121
+ environment, any gems we want to be available to the `test_data` gem need to be
122
+ installed with a `:test_data` group.
123
+
124
+ Since the `test_data` environment is designed to be used similarly to
125
+ `development` (i.e. with a running server and interacting via a browser), any
126
+ gems in your `:development` gem group should likely be included in a
127
+ `:test_data` gem group as well.
128
+
129
+ For example, this:
113
130
 
114
131
  ```ruby
115
- group :development, :test, :test_data do
132
+ group :development, :test do
133
+ gem "standard"
134
+ gem "cypress-rails"
116
135
  gem "test_data"
117
- # … other gems available to development & test
118
136
  end
119
137
  ```
120
138
 
121
- Since the `test_data` environment is designed to be used similarly to
122
- `development` (i.e. with a running server and interacting via a browser), any
123
- gems in your `:development` gem group should likely be included in a
124
- `:test_data` gem group as well.
139
+ Should have its first line changed to:
140
+
141
+ ```ruby
142
+ group :development, :test, :test_data do
143
+ ```
144
+
145
+ #### Adding the gem
146
+
147
+ Finally, add `test_data` to your Gemfile and `bundle install` it:
148
+
149
+ ```ruby
150
+ gem "test_data"
151
+ ```
125
152
 
126
153
  #### Configuring the gem and initializing the database
127
154
 
data/example/Gemfile.lock CHANGED
@@ -1,84 +1,84 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- test_data (0.3.1)
4
+ test_data (0.4.0)
5
5
  railties (>= 6.0, < 8.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.2.3)
11
- actionpack (= 7.0.2.3)
12
- activesupport (= 7.0.2.3)
10
+ actioncable (7.0.4)
11
+ actionpack (= 7.0.4)
12
+ activesupport (= 7.0.4)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.2.3)
16
- actionpack (= 7.0.2.3)
17
- activejob (= 7.0.2.3)
18
- activerecord (= 7.0.2.3)
19
- activestorage (= 7.0.2.3)
20
- activesupport (= 7.0.2.3)
15
+ actionmailbox (7.0.4)
16
+ actionpack (= 7.0.4)
17
+ activejob (= 7.0.4)
18
+ activerecord (= 7.0.4)
19
+ activestorage (= 7.0.4)
20
+ activesupport (= 7.0.4)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.0.2.3)
26
- actionpack (= 7.0.2.3)
27
- actionview (= 7.0.2.3)
28
- activejob (= 7.0.2.3)
29
- activesupport (= 7.0.2.3)
25
+ actionmailer (7.0.4)
26
+ actionpack (= 7.0.4)
27
+ actionview (= 7.0.4)
28
+ activejob (= 7.0.4)
29
+ activesupport (= 7.0.4)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.0)
35
- actionpack (7.0.2.3)
36
- actionview (= 7.0.2.3)
37
- activesupport (= 7.0.2.3)
35
+ actionpack (7.0.4)
36
+ actionview (= 7.0.4)
37
+ activesupport (= 7.0.4)
38
38
  rack (~> 2.0, >= 2.2.0)
39
39
  rack-test (>= 0.6.3)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.2.3)
43
- actionpack (= 7.0.2.3)
44
- activerecord (= 7.0.2.3)
45
- activestorage (= 7.0.2.3)
46
- activesupport (= 7.0.2.3)
42
+ actiontext (7.0.4)
43
+ actionpack (= 7.0.4)
44
+ activerecord (= 7.0.4)
45
+ activestorage (= 7.0.4)
46
+ activesupport (= 7.0.4)
47
47
  globalid (>= 0.6.0)
48
48
  nokogiri (>= 1.8.5)
49
- actionview (7.0.2.3)
50
- activesupport (= 7.0.2.3)
49
+ actionview (7.0.4)
50
+ activesupport (= 7.0.4)
51
51
  builder (~> 3.1)
52
52
  erubi (~> 1.4)
53
53
  rails-dom-testing (~> 2.0)
54
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.2.3)
56
- activesupport (= 7.0.2.3)
55
+ activejob (7.0.4)
56
+ activesupport (= 7.0.4)
57
57
  globalid (>= 0.3.6)
58
- activemodel (7.0.2.3)
59
- activesupport (= 7.0.2.3)
60
- activerecord (7.0.2.3)
61
- activemodel (= 7.0.2.3)
62
- activesupport (= 7.0.2.3)
63
- activestorage (7.0.2.3)
64
- actionpack (= 7.0.2.3)
65
- activejob (= 7.0.2.3)
66
- activerecord (= 7.0.2.3)
67
- activesupport (= 7.0.2.3)
58
+ activemodel (7.0.4)
59
+ activesupport (= 7.0.4)
60
+ activerecord (7.0.4)
61
+ activemodel (= 7.0.4)
62
+ activesupport (= 7.0.4)
63
+ activestorage (7.0.4)
64
+ actionpack (= 7.0.4)
65
+ activejob (= 7.0.4)
66
+ activerecord (= 7.0.4)
67
+ activesupport (= 7.0.4)
68
68
  marcel (~> 1.0)
69
69
  mini_mime (>= 1.1.0)
70
- activesupport (7.0.2.3)
70
+ activesupport (7.0.4)
71
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
74
74
  tzinfo (~> 2.0)
75
- addressable (2.8.0)
76
- public_suffix (>= 2.0.2, < 5.0)
75
+ addressable (2.8.1)
76
+ public_suffix (>= 2.0.2, < 6.0)
77
77
  ast (2.4.2)
78
- bootsnap (1.11.1)
78
+ bootsnap (1.13.0)
79
79
  msgpack (~> 1.2)
80
80
  builder (3.2.4)
81
- capybara (3.36.0)
81
+ capybara (3.38.0)
82
82
  addressable
83
83
  matrix
84
84
  mini_mime (>= 0.1.3)
@@ -92,8 +92,7 @@ GEM
92
92
  concurrent-ruby (1.1.10)
93
93
  crass (1.0.6)
94
94
  diff-lcs (1.5.0)
95
- digest (3.1.0)
96
- erubi (1.10.0)
95
+ erubi (1.11.0)
97
96
  factory_bot (6.2.1)
98
97
  activesupport (>= 5.0.0)
99
98
  factory_bot_rails (6.2.0)
@@ -101,10 +100,10 @@ GEM
101
100
  railties (>= 5.0.0)
102
101
  globalid (1.0.0)
103
102
  activesupport (>= 5.0)
104
- i18n (1.10.0)
103
+ i18n (1.12.0)
105
104
  concurrent-ruby (~> 1.0)
106
- io-wait (0.2.1)
107
- loofah (2.15.0)
105
+ json (2.6.2)
106
+ loofah (2.19.0)
108
107
  crass (~> 1.0.2)
109
108
  nokogiri (>= 1.5.9)
110
109
  mail (2.7.1)
@@ -114,130 +113,125 @@ GEM
114
113
  method_source (1.0.0)
115
114
  mini_mime (1.1.2)
116
115
  mini_portile2 (2.8.0)
117
- minitest (5.15.0)
118
- msgpack (1.4.5)
119
- net-imap (0.2.3)
120
- digest
116
+ minitest (5.16.3)
117
+ msgpack (1.6.0)
118
+ net-imap (0.3.1)
121
119
  net-protocol
122
- strscan
123
- net-pop (0.1.1)
124
- digest
120
+ net-pop (0.1.2)
125
121
  net-protocol
122
+ net-protocol (0.1.3)
126
123
  timeout
127
- net-protocol (0.1.2)
128
- io-wait
129
- timeout
130
- net-smtp (0.3.1)
131
- digest
124
+ net-smtp (0.3.3)
132
125
  net-protocol
133
- timeout
134
126
  nio4r (2.5.8)
135
- nokogiri (1.13.3)
127
+ nokogiri (1.13.9)
136
128
  mini_portile2 (~> 2.8.0)
137
129
  racc (~> 1.4)
138
130
  noncommittal (0.2.0)
139
131
  parallel (1.22.1)
140
- parser (3.1.1.0)
132
+ parser (3.1.2.1)
141
133
  ast (~> 2.4.1)
142
- pg (1.3.4)
134
+ pg (1.4.4)
143
135
  pry (0.14.1)
144
136
  coderay (~> 1.1)
145
137
  method_source (~> 1.0)
146
138
  pry-rails (0.3.9)
147
139
  pry (>= 0.10.4)
148
- public_suffix (4.0.6)
149
- puma (5.6.2)
140
+ public_suffix (5.0.0)
141
+ puma (6.0.0)
150
142
  nio4r (~> 2.0)
151
143
  racc (1.6.0)
152
- rack (2.2.3)
153
- rack-test (1.1.0)
154
- rack (>= 1.0, < 3)
155
- rails (7.0.2.3)
156
- actioncable (= 7.0.2.3)
157
- actionmailbox (= 7.0.2.3)
158
- actionmailer (= 7.0.2.3)
159
- actionpack (= 7.0.2.3)
160
- actiontext (= 7.0.2.3)
161
- actionview (= 7.0.2.3)
162
- activejob (= 7.0.2.3)
163
- activemodel (= 7.0.2.3)
164
- activerecord (= 7.0.2.3)
165
- activestorage (= 7.0.2.3)
166
- activesupport (= 7.0.2.3)
144
+ rack (2.2.4)
145
+ rack-test (2.0.2)
146
+ rack (>= 1.3)
147
+ rails (7.0.4)
148
+ actioncable (= 7.0.4)
149
+ actionmailbox (= 7.0.4)
150
+ actionmailer (= 7.0.4)
151
+ actionpack (= 7.0.4)
152
+ actiontext (= 7.0.4)
153
+ actionview (= 7.0.4)
154
+ activejob (= 7.0.4)
155
+ activemodel (= 7.0.4)
156
+ activerecord (= 7.0.4)
157
+ activestorage (= 7.0.4)
158
+ activesupport (= 7.0.4)
167
159
  bundler (>= 1.15.0)
168
- railties (= 7.0.2.3)
160
+ railties (= 7.0.4)
169
161
  rails-dom-testing (2.0.3)
170
162
  activesupport (>= 4.2.0)
171
163
  nokogiri (>= 1.6)
172
- rails-html-sanitizer (1.4.2)
164
+ rails-html-sanitizer (1.4.3)
173
165
  loofah (~> 2.3)
174
- railties (7.0.2.3)
175
- actionpack (= 7.0.2.3)
176
- activesupport (= 7.0.2.3)
166
+ railties (7.0.4)
167
+ actionpack (= 7.0.4)
168
+ activesupport (= 7.0.4)
177
169
  method_source
178
170
  rake (>= 12.2)
179
171
  thor (~> 1.0)
180
172
  zeitwerk (~> 2.5)
181
173
  rainbow (3.1.1)
182
174
  rake (13.0.6)
183
- regexp_parser (2.2.1)
175
+ regexp_parser (2.6.0)
184
176
  rexml (3.2.5)
185
- rspec-core (3.11.0)
186
- rspec-support (~> 3.11.0)
187
- rspec-expectations (3.11.0)
177
+ rspec-core (3.12.0)
178
+ rspec-support (~> 3.12.0)
179
+ rspec-expectations (3.12.0)
188
180
  diff-lcs (>= 1.2.0, < 2.0)
189
- rspec-support (~> 3.11.0)
190
- rspec-mocks (3.11.0)
181
+ rspec-support (~> 3.12.0)
182
+ rspec-mocks (3.12.0)
191
183
  diff-lcs (>= 1.2.0, < 2.0)
192
- rspec-support (~> 3.11.0)
193
- rspec-rails (5.1.1)
194
- actionpack (>= 5.2)
195
- activesupport (>= 5.2)
196
- railties (>= 5.2)
197
- rspec-core (~> 3.10)
198
- rspec-expectations (~> 3.10)
199
- rspec-mocks (~> 3.10)
200
- rspec-support (~> 3.10)
201
- rspec-support (3.11.0)
202
- rubocop (1.26.0)
184
+ rspec-support (~> 3.12.0)
185
+ rspec-rails (6.0.1)
186
+ actionpack (>= 6.1)
187
+ activesupport (>= 6.1)
188
+ railties (>= 6.1)
189
+ rspec-core (~> 3.11)
190
+ rspec-expectations (~> 3.11)
191
+ rspec-mocks (~> 3.11)
192
+ rspec-support (~> 3.11)
193
+ rspec-support (3.12.0)
194
+ rubocop (1.35.1)
195
+ json (~> 2.3)
203
196
  parallel (~> 1.10)
204
- parser (>= 3.1.0.0)
197
+ parser (>= 3.1.2.1)
205
198
  rainbow (>= 2.2.2, < 4.0)
206
199
  regexp_parser (>= 1.8, < 3.0)
207
- rexml
208
- rubocop-ast (>= 1.16.0, < 2.0)
200
+ rexml (>= 3.2.5, < 4.0)
201
+ rubocop-ast (>= 1.20.1, < 2.0)
209
202
  ruby-progressbar (~> 1.7)
210
203
  unicode-display_width (>= 1.4.0, < 3.0)
211
- rubocop-ast (1.16.0)
204
+ rubocop-ast (1.23.0)
212
205
  parser (>= 3.1.1.0)
213
- rubocop-performance (1.13.3)
206
+ rubocop-performance (1.14.3)
214
207
  rubocop (>= 1.7.0, < 2.0)
215
208
  rubocop-ast (>= 0.4.0)
216
209
  ruby-progressbar (1.11.0)
217
210
  rubyzip (2.3.2)
218
- selenium-webdriver (4.1.0)
211
+ selenium-webdriver (4.6.1)
219
212
  childprocess (>= 0.5, < 5.0)
220
213
  rexml (~> 3.2, >= 3.2.5)
221
- rubyzip (>= 1.2.2)
222
- standard (1.9.0)
223
- rubocop (= 1.26.0)
224
- rubocop-performance (= 1.13.3)
225
- strscan (3.0.1)
214
+ rubyzip (>= 1.2.2, < 3.0)
215
+ websocket (~> 1.0)
216
+ standard (1.16.1)
217
+ rubocop (= 1.35.1)
218
+ rubocop-performance (= 1.14.3)
226
219
  thor (1.2.1)
227
- timeout (0.2.0)
228
- tzinfo (2.0.4)
220
+ timeout (0.3.0)
221
+ tzinfo (2.0.5)
229
222
  concurrent-ruby (~> 1.0)
230
- unicode-display_width (2.1.0)
231
- webdrivers (5.0.0)
223
+ unicode-display_width (2.3.0)
224
+ webdrivers (5.2.0)
232
225
  nokogiri (~> 1.6)
233
226
  rubyzip (>= 1.3.0)
234
227
  selenium-webdriver (~> 4.0)
228
+ websocket (1.2.9)
235
229
  websocket-driver (0.7.5)
236
230
  websocket-extensions (>= 0.1.0)
237
231
  websocket-extensions (0.1.5)
238
232
  xpath (3.2.0)
239
233
  nokogiri (~> 1.8)
240
- zeitwerk (2.5.4)
234
+ zeitwerk (2.6.6)
241
235
 
242
236
  PLATFORMS
243
237
  ruby
@@ -4,22 +4,36 @@ require_relative "../../test_data/generator_support"
4
4
  module TestData
5
5
  class WebpackerYamlGenerator < Rails::Generators::Base
6
6
  AFTER_DEVELOPMENT_WEBPACK_STANZA_REGEX = /^development:/
7
+ AFTER_TEST_DATA_WEBPACK_STANZA_REGEX = /^test_data:\n <<: \*development/
7
8
 
8
9
  def call
9
- if Configurators::WebpackerYaml.new.verify.looks_good?
10
- TestData.log.debug "'test_data' section not needed in config/webpacker.yml"
10
+ configurator = Configurators::WebpackerYaml.new
11
+ webpacker_config = Wrap::WebpackerConfig.new
12
+
13
+ if configurator.verify.looks_good?
14
+ TestData.log.debug "'test_data' section looks good in `config/webpacker.yml'"
11
15
  else
12
- inject_into_file "config/webpacker.yml", after: AFTER_DEVELOPMENT_WEBPACK_STANZA_REGEX do
13
- " &development"
14
- end
15
- inject_into_file "config/webpacker.yml", before: BEFORE_TEST_STANZA_REGEX do
16
- <<~YAML
16
+ unless webpacker_config.user_config.key?("test_data")
17
+ inject_into_file "config/webpacker.yml", after: AFTER_DEVELOPMENT_WEBPACK_STANZA_REGEX do
18
+ " &development"
19
+ end
20
+ inject_into_file "config/webpacker.yml", before: BEFORE_TEST_STANZA_REGEX do
21
+ <<~YAML
17
22
 
18
- # Used in conjunction with the test_data gem
19
- test_data:
20
- <<: *development
23
+ # Used in conjunction with the test_data gem
24
+ test_data:
25
+ <<: *development
26
+
27
+ YAML
28
+ end
29
+ end
21
30
 
22
- YAML
31
+ if (missing_entries = webpacker_config.required_entries_missing_from_test_data_config)
32
+ inject_into_file "config/webpacker.yml", after: /^test_data:\n/ do
33
+ missing_entries.map { |(key, val)|
34
+ " #{key}: #{val.inspect}\n"
35
+ }.join
36
+ end
23
37
  end
24
38
  end
25
39
  end
@@ -1,3 +1,5 @@
1
+ require_relative "./yaml_loader"
2
+
1
3
  module TestData
2
4
  def self.config(pwd: Rails.root, &blk)
3
5
  @configuration ||= Configuration.new(pwd: pwd)
@@ -95,7 +97,7 @@ module TestData
95
97
  end
96
98
 
97
99
  def database_yaml
98
- YAML.load_file(database_yaml_full_path)
100
+ YAMLLoader.load_file(database_yaml_full_path)
99
101
  end
100
102
 
101
103
  def database_name
@@ -1,3 +1,5 @@
1
+ require_relative "../yaml_loader"
2
+
1
3
  module TestData
2
4
  module Configurators
3
5
  class CableYaml
@@ -8,7 +10,7 @@ module TestData
8
10
 
9
11
  def verify
10
12
  if !File.exist?(@config.cable_yaml_full_path) ||
11
- YAML.load_file(@config.cable_yaml_full_path).key?("test_data")
13
+ YAMLLoader.load_file(@config.cable_yaml_full_path).key?("test_data")
12
14
  ConfigurationVerification.new(looks_good?: true)
13
15
  else
14
16
  ConfigurationVerification.new(problems: [
@@ -1,3 +1,5 @@
1
+ require_relative "../yaml_loader"
2
+
1
3
  module TestData
2
4
  module Configurators
3
5
  class SecretsYaml
@@ -8,7 +10,7 @@ module TestData
8
10
 
9
11
  def verify
10
12
  if !File.exist?(@config.secrets_yaml_full_path) ||
11
- YAML.load_file(@config.secrets_yaml_full_path).key?("test_data")
13
+ YAMLLoader.load_file(@config.secrets_yaml_full_path).key?("test_data")
12
14
  ConfigurationVerification.new(looks_good?: true)
13
15
  else
14
16
  ConfigurationVerification.new(problems: [
@@ -3,21 +3,23 @@ module TestData
3
3
  class WebpackerYaml
4
4
  def initialize
5
5
  @generator = WebpackerYamlGenerator.new
6
- @config = TestData.config
6
+ @webpacker_config = Wrap::WebpackerConfig.new
7
7
  end
8
8
 
9
9
  def verify
10
- path = "config/webpacker.yml"
11
- pathname = Pathname.new("#{@config.pwd}/#{path}")
12
- return ConfigurationVerification.new(looks_good?: true) unless pathname.readable?
13
- yaml = load_yaml(pathname)
14
- if yaml.nil?
10
+ if @webpacker_config.no_user_config_exists?
11
+ ConfigurationVerification.new(looks_good?: true)
12
+ elsif (user_config = @webpacker_config.user_config).nil?
13
+ ConfigurationVerification.new(problems: [
14
+ "`#{@webpacker_config.relative_user_config_path}' is not valid YAML"
15
+ ])
16
+ elsif !user_config.key?("test_data")
15
17
  ConfigurationVerification.new(problems: [
16
- "'#{path}' is not valid YAML"
18
+ "`#{@webpacker_config.relative_user_config_path}' does not contain a `test_data' section"
17
19
  ])
18
- elsif !yaml.key?("test_data")
20
+ elsif (entries = @webpacker_config.required_entries_missing_from_test_data_config)
19
21
  ConfigurationVerification.new(problems: [
20
- "'#{path}' does not contain a 'test_data' section"
22
+ "`#{@webpacker_config.relative_user_config_path}' is missing #{"entry".pluralize(entries.size)} #{entries.map { |(k, v)| "`#{k}' (default: #{v.inspect})" }.join(", ")} in its `test_data' section"
21
23
  ])
22
24
  else
23
25
  ConfigurationVerification.new(looks_good?: true)
@@ -27,13 +29,6 @@ module TestData
27
29
  def configure
28
30
  @generator.call
29
31
  end
30
-
31
- private
32
-
33
- def load_yaml(pathname)
34
- YAML.load_file(pathname)
35
- rescue
36
- end
37
32
  end
38
33
  end
39
34
  end
@@ -80,7 +80,7 @@ module TestData
80
80
 
81
81
  def log_size_info_and_warnings(before_size:, after_size:)
82
82
  percent_change = percent_change(before_size, after_size)
83
- TestData.log.info " Size: #{to_size(after_size)}#{" (#{percent_change}% #{before_size > after_size ? "decrease" : "increase"})" if percent_change}"
83
+ TestData.log.info " Size: #{to_size(after_size)}#{" (#{percent_change}% #{(before_size > after_size) ? "decrease" : "increase"})" if percent_change}"
84
84
  if after_size > 5242880
85
85
  TestData.log.warn " WARNING: file size exceeds 5MB. Be sure to only persist what data you need to sufficiently test your application"
86
86
  end
@@ -3,7 +3,7 @@ def wrong_env?
3
3
  end
4
4
 
5
5
  def run_in_test_data_env(task_name)
6
- command = "RAILS_ENV=test_data #{Rails.root}/bin/rake #{task_name}"
6
+ command = "RAILS_ENV=test_data #{Rails.root}/bin/rake #{task_name} --trace"
7
7
  unless system(command)
8
8
  fail "An error ocurred when running: #{command}"
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module TestData
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,44 @@
1
+ require_relative "../yaml_loader"
2
+
3
+ module TestData
4
+ module Wrap
5
+ class WebpackerConfig
6
+ def initialize
7
+ @user_config_path = Pathname.new("#{TestData.config.pwd}/config/webpacker.yml")
8
+ end
9
+
10
+ def relative_user_config_path
11
+ @user_config_path.relative_path_from(Rails.root)
12
+ end
13
+
14
+ def no_user_config_exists?
15
+ !@user_config_path.readable?
16
+ end
17
+
18
+ def user_config
19
+ load_yaml(@user_config_path)
20
+ end
21
+
22
+ def webpacker_gem_spec_loaded?
23
+ !!Gem.loaded_specs["webpacker"]
24
+ end
25
+
26
+ def builtin_config
27
+ webpacker_path = Gem.loaded_specs["webpacker"].full_gem_path
28
+ load_yaml(File.join(webpacker_path, "lib/install/config/webpacker.yml"))
29
+ end
30
+
31
+ def required_entries_missing_from_test_data_config
32
+ missing_keys = builtin_config["development"].keys - user_config["test_data"].keys
33
+ builtin_config["development"].slice(*missing_keys).presence
34
+ end
35
+
36
+ private
37
+
38
+ def load_yaml(path)
39
+ YAMLLoader.load_file(path)
40
+ rescue
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,11 @@
1
+ module TestData
2
+ module YAMLLoader
3
+ def self.load_file(path)
4
+ begin
5
+ YAML.load_file(path, aliases: true)
6
+ rescue ArgumentError
7
+ YAML.load_file(path)
8
+ end
9
+ end
10
+ end
11
+ end
data/lib/test_data.rb CHANGED
@@ -11,6 +11,7 @@ require_relative "test_data/configurators/secrets_yaml"
11
11
  require_relative "test_data/configurators/webpacker_yaml"
12
12
  require_relative "test_data/custom_loaders/abstract_base"
13
13
  require_relative "test_data/custom_loaders/rails_fixtures"
14
+ require_relative "test_data/wrap/webpacker_config"
14
15
  require_relative "test_data/detects_database_emptiness"
15
16
  require_relative "test_data/detects_database_existence"
16
17
  require_relative "test_data/determines_when_sql_dump_was_made"
data/test_data.gemspec CHANGED
@@ -7,6 +7,11 @@ Gem::Specification.new do |spec|
7
7
  spec.email = ["searls@gmail.com"]
8
8
 
9
9
  spec.summary = "Dumps and Loads data for your Rails app's tests"
10
+ spec.description = <<~DESCRIPTION
11
+ DEPRECATED: test_data is deprecated and unmaintained. We have no plans to hand off the package or resurrect it, but you are of course welcome to fork it.
12
+
13
+ Dumps and Loads data for your Rails app's tests
14
+ DESCRIPTION
10
15
  spec.homepage = "https://github.com/testdouble/test_data"
11
16
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
12
17
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-03-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: railties
@@ -30,7 +29,10 @@ dependencies:
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: '8.0'
33
- description:
32
+ description: |
33
+ DEPRECATED: test_data is deprecated and unmaintained. We have no plans to hand off the package or resurrect it, but you are of course welcome to fork it.
34
+
35
+ Dumps and Loads data for your Rails app's tests
34
36
  email:
35
37
  - searls@gmail.com
36
38
  executables: []
@@ -164,6 +166,8 @@ files:
164
166
  - lib/test_data/version.rb
165
167
  - lib/test_data/warns_if_database_is_newer_than_dump.rb
166
168
  - lib/test_data/warns_if_dump_is_newer_than_database.rb
169
+ - lib/test_data/wrap/webpacker_config.rb
170
+ - lib/test_data/yaml_loader.rb
167
171
  - script/reset_example_app
168
172
  - script/test
169
173
  - test_data.gemspec
@@ -173,7 +177,6 @@ metadata:
173
177
  homepage_uri: https://github.com/testdouble/test_data
174
178
  source_code_uri: https://github.com/testdouble/test_data
175
179
  changelog_uri: https://github.com/testdouble/test_data/blob/main/CHANGELOG.md
176
- post_install_message:
177
180
  rdoc_options: []
178
181
  require_paths:
179
182
  - lib
@@ -188,8 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
191
  - !ruby/object:Gem::Version
189
192
  version: '0'
190
193
  requirements: []
191
- rubygems_version: 3.3.6
192
- signing_key:
194
+ rubygems_version: 4.0.21
193
195
  specification_version: 4
194
196
  summary: Dumps and Loads data for your Rails app's tests
195
197
  test_files: []