rails--rails/activestorage/test
Richard Macklin 6b6e10d02e Enforce that activestorage compiled JS is in sync with source code
(Note: this is effectively the same change that we did for actioncable
in fefc304199 applied to activestorage.)

We have run into issues in the past where the activestorage compiled
javascript bundle got out of sync with the source code. For example, in
880f977925 the compiled bundle was
modified in a way that was inconsistent with the results of running
`yarn build` in the activestorage directory. This meant that running
`yarn build` there would produce a dirty git status indicating changes
to the compiled bundle, despite not having made any changes to the
activestorage javascript source code. That particular inconsistency was
fixed in 0e77706dc5. However, the same
problem could reoccur.

To address this, I've added a new test to enforce that activestorage's
compiled javascript bundle is in sync with the source code. When the
compiled bundle is in sync with the source code, the test will pass.
However, if the two are not in sync, the test will fail. For example, if
you were to apply the following patch (which only updates the source
code):

```
diff --git a/activestorage/app/javascript/activestorage/index.js b/activestorage/app/javascript/activestorage/index.js
index a340008fb9..a05b7223a5 100644
--- a/activestorage/app/javascript/activestorage/index.js
+++ b/activestorage/app/javascript/activestorage/index.js
@@ -8,4 +8,4 @@ function autostart() {
   }
 }

-setTimeout(autostart, 1)
+setTimeout(autostart, 2)
```
the test would then fail. Thus, the activestorage test suite will now
prevent "the compiled bundle is out of sync" issues going forward.
2019-10-18 18:02:02 -07:00
..
analyzer Fix typo s/:heigh/:height/ 2019-10-03 15:42:47 +09:00
controllers Permanent URLs for public storage blobs 2019-10-11 15:14:43 -04:00
database Refactor migration to move migrations paths to connection 2018-01-18 08:55:03 -05:00
dummy Refactor max-age seconds 2019-08-18 21:29:52 +09:00
fixtures/files Use a smaller TIFF file as fixture 2019-07-27 23:08:49 +05:30
jobs Correct test class name 2019-09-28 10:31:26 -04:00
models Use transactional tests to avoid deleting blobs from other tests 2019-10-11 18:20:14 -04:00
previewer Change video preview format from PNG to JPG 2018-05-23 14:32:34 -04:00
service Permanent URLs for public storage blobs 2019-10-11 15:14:43 -04:00
template url -> URL where apt except inside actionpack/ 2019-04-01 22:56:35 +05:30
javascript_package_test.rb Enforce that activestorage compiled JS is in sync with source code 2019-10-18 18:02:02 -07:00
test_helper.rb Use transactional tests to avoid deleting blobs from other tests 2019-10-11 18:20:14 -04:00