Commit Graph

142 Commits

Author SHA1 Message Date
Jean Boussier
12f3f11f61 Use URI::DEFAULT_PARSER rather than instantiate a new one 2020-06-29 23:06:34 +02:00
Ryuta Kamizono
d558febe32 Auto-correct rubocop offences 2019-11-24 09:54:47 +09:00
John Hawthorn
75afb43a25 Use rails() instead of system() 2019-11-14 12:31:56 -08:00
John Hawthorn
72b1ae6a5a Sprockets uses debug. not self. now 2019-10-10 14:43:03 -07:00
John Hawthorn
441917629e Link .js from manifest.js in assets_test
We no longer link JS by default, we need to modify manifest.js for that
now.
2019-10-10 14:43:03 -07:00
John Hawthorn
8d037fd3dd Remove a javascript from test 2019-10-10 14:43:03 -07:00
John Hawthorn
e63695535e Use a stylesheet instead of a javascript in test
We no longer link all js by default, so we should do this test with a
css instead (we don't care about that specifics of the dir just that its
in the manifest and in this dir).
2019-10-10 14:43:03 -07:00
John Hawthorn
5a4d4c7492 Maybe we understand index.js better now? 2019-10-10 14:43:03 -07:00
John Hawthorn
added06d3f Add a few more assertions 2019-10-10 14:43:03 -07:00
John Hawthorn
4cb93a39e2 Fix Sprockets::DoubleLinkError in test 2019-10-09 21:48:37 -07:00
Akira Matsuda
0196551e60 Use match? where we don't need MatchData 2019-07-29 14:23:10 +09:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
Sharang Dashputre
771973c13d url -> URL where apt except inside actionpack/ 2019-04-01 22:56:35 +05:30
David Heinemeier Hansson
4838c1716a
Make Webpacker the default JavaScript compiler for Rails 6 (#33079)
* Use Webpacker by default on new apps

* Stop including coffee-rails by default

* Drop using a js_compressor by default

* Drop extra test for coffeescript inclusion by default

* Stick with skip_javascript to signify skipping webpack

* Don't install a JS runtime by default any more

* app/javascript will be the new default directory for JS

* Make it clear that this is just for configuring the default Webpack framework setup now

* Start using the Webpack tag in the default layout

* Irrelevant test

* jQuery is long gone

* Stop having asset pipeline compile default application.js

* Add rails-ujs by default to the Webpack setup

* Add Active Storage JavaScript to application.js pack by default

* Consistent quoting

* Add Turbolinks to default pack

* Add Action Cable to default pack

Need some work on how to set the global consumer that channels will
work with. @javan?

* Require all channels by default and use a separate consumer stub

* Channel generator now targets Webpack style

* Update task docs to match new generator style

* Use uniform import style

* Drop the JS assets generator

It was barely helpful as it was. It’s no longer helpful in a Webpacked
world. Sayonara!

* Add app/javascript to the stats directories

* Simpler import style

Which match the other imports.

* Address test failures from dropping JS compilation (and compression)

* webpacker-default: Modify `AssetsGeneratorTest`

Before:

```
$ bin/test test/generators/assets_generator_test.rb
Run options: --seed 46201

F

Failure:
AssetsGeneratorTest#test_assets [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:12]:
Expected file "app/assets/javascripts/posts.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:10

.

Finished in 0.031343s, 63.8101 runs/s, 95.7152 assertions/s.
2 runs, 3 assertions, 1 failures, 0 errors, 0 skips
```

After:

```
$ bin/test test/generators/assets_generator_test.rb
Run options: --seed 43571

..

Finished in 0.030370s, 65.8545 runs/s, 65.8545 assertions/s.
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
```

* webpacker-default: Modify `ChannelGeneratorTest`

Before:

```
$ bin/test test/generators/channel_generator_test.rb
Run options: --seed 8986

.F

Failure:
ChannelGeneratorTest#test_channel_with_multiple_actions_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:43]:
Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:34

.F

Failure:
ChannelGeneratorTest#test_channel_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:29]:
Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:22

E

Error:
ChannelGeneratorTest#test_cable_js_is_created_if_not_present_already:
Errno::ENOENT: No such file or directory @ apply2files - /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/fixtures/tmp/app/assets/javascripts/cable.js

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:60

F

Failure:
ChannelGeneratorTest#test_channel_suffix_is_not_duplicated [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:87]:
Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:80

F

Failure:
ChannelGeneratorTest#test_channel_on_revoke [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:77]:
Expected file "app/assets/javascripts/cable.js" to exist, but does not

bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:68

Finished in 0.064384s, 108.7227 runs/s, 481.4861 assertions/s.
7 runs, 31 assertions, 4 failures, 1 errors, 0 skips
```

After:

```
$ bin/test test/generators/channel_generator_test.rb
Run options: --seed 44857

.......

Finished in 0.060243s, 116.1961 runs/s, 697.1764 assertions/s.
7 runs, 42 assertions, 0 failures, 0 errors, 0 skips
```

* Fix shared generator tests.

* webpacker-default: Modify `ControllerGeneratorTest`

The JS assets generator was dropped. ref. 46215b1794

* Revert "Simpler import style". It's currently failing with an error of "TypeError: undefined is not an object (evaluating '__WEBPACK_IMPORTED_MODULE_2_activestorage___default.a.start')". Waiting for @javan to have a look.

This reverts commit 5d3ebb71059f635d3756cbda4ab9752027e09256.

* require webpacker in test app

* Add webpacker without making the build hang/timeout. (#33640)

* use yarn workspaces to allow for installing unreleased packages and only generate js/bootsnap when required

* no longer need to have webpacker in env templates as webpacker moved this config to yml file

* Fix rubocop violation

* Got the test passing for the running scaffold

* update expected lines of code

* update middleware tests to account for webpacker

* disable js in plugins be default to get the tests passing (#34009)

* clear codeclimate report issues

* Anything newer than currently released is good

* Use Webpacker development version during development of Rails

* Edge should get development webpacker as well

* Add changelog entry for Webpacker change
2018-09-30 22:31:21 -07:00
Ryuta Kamizono
1dc17e7b2e Fix CustomCops/AssertNot to allow it to have failure message
Follow up of #32605.
2018-05-13 11:32:47 +09:00
Daniel Colson
a1ac18671a Replace assert ! with assert_not
This autocorrects the violations after adding a custom cop in
3305c78dcd.
2018-04-19 08:11:33 -04:00
yuuji.yaginuma
603475b76f Remove needless silence_warnings
Since ff30db1, warning is not shown.
2017-09-09 09:48:15 +09:00
Koichi ITO
7c260ae201 Fix RuboCop offenses
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
2017-08-16 17:55:25 +09:00
Pat Allan
acea68de02 Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Akira Matsuda
e8ba0c0f21 "Use assert_nil if expecting nil. This will fail in minitest 6." 2016-12-25 02:29:52 +09:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Rafael Mendonça França
79a5ea9ead
Remove deprecated support to :text in render 2016-10-10 00:02:52 -03:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
783763bde9 applies new string literal convention in railties/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:16:09 +02:00
Prathamesh Sonpatki
d93427840e
Remove unused boot_rails method and it's usage
- The `boot_rails` method from abstract_unit.rb is empty after 2abcdfd978fdcd491576a237e8c6b.
- So let's remove it and its usage.
2016-07-04 09:34:21 +05:30
Rafael Mendonça França
14dc9b9cd9
Use sass-rails in our test suite 2016-06-30 19:39:37 -03:00
Jon Moss
9cd790d77d
md5 --> MD5
Sorry, I missed a few places in my last PR. This should be the last of
'em 😬
2016-05-17 15:44:57 -04:00
yuuji.yaginuma
ab18d37fa4 do not create unnecessary directory
This was added in a4c358f, but `config.assets` has been removed in 5172d93.
Also, do not use env path to `Sprockets::Cache::FileStore` even `sprockets-rails`.
ref: https://github.com/rails/sprockets-rails/blob/master/lib/sprockets/railtie.rb#L129
2016-04-10 20:43:07 +09:00
Rafael Mendonça França
e2f08a1c0a Add test to make sure the sprockets cache is not shared per environment 2016-03-02 14:22:02 -03:00
Vipul A M
e3b04447f4 Be consistent in testing outputs from railties test and use /bin/rails everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere
[Ryo Hashimoto & Vipul A M]
2016-01-24 20:01:02 +05:30
Rafael Mendonça França
80ba81d2a0 Fix warning 2015-12-17 17:35:20 -02:00
David Heinemeier Hansson
42b9126610 Fix test now that cable is in there by default too 2015-12-16 22:02:43 +01:00
Rafael Mendonça França
877a411d0c Use sprockets 3 in the Rails 5 release 2015-12-16 16:30:58 -02:00
Kasper Timm Hansen
fa2c96b3f7 Replace serve_static_files in tests with public_file_server.enabled.
Forgot to do it in 748b2f9, when deprecating `serve_static_files`.
2015-11-04 22:40:58 +01:00
Jeremy Daer
20ec1e922c Eliminate overlapping app/assets load path
* Move `app/assets/manifest.js` to `app/assets/config/manifest.js`.
  Avoid the suggestion that you can/should deep-link `stylesheets/foo`.
* Pull in all toplevel stylesheets and JavaScripts, not just
  `application.js` and `.css`. Demonstrate how to use `link_directory`
  with a specified `.js`/`.css` type.
* Fix RAILS_ENV handling in assets tests.
* Shush warnings spam from third-party libs that distract from tests.
2015-09-29 11:56:58 -07:00
Andrei Istratii
d0e0fbafb2 Migrate to Sprockets 4. 2015-08-19 21:45:46 +03:00
schneems
4bc2469156 Fix reported regression rails/sprockets-rails#265
We can prevent the UglifierCompressor from being instantiated prematurely by setting precompile to an empty array in this test.
2015-07-29 20:12:56 -05:00
Yves Senn
a8f250a22c tests, railties tests should use bin/ executables when possible.
We recommend using the `bin/` executables in our docs and guides.
Let's make sure that our tests execute the same code path.
2015-06-30 11:19:01 +02:00
Arthur Neves
64114b66d2
Need to add config.assets.compile=true to access .assets
sprockets-rails will only add `Rails.application.assets` if compile is
no false. See change on sprockets-rails
d7c7ee1999
2015-04-26 12:55:05 -04:00
Arthur Neves
d023f98497
assets:cache:clean wont clean cache anymore
See the behaviour change on sprockets-rails
56725e5843
2015-04-26 12:54:16 -04:00
Rafael Mendonça França
a8225eeec2 Test using sprockets 3 2015-03-29 22:58:32 -03:00
Vipul A M
6eced6a1fe Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 onwards. 2015-02-03 20:51:40 +05:30
Godfrey Chan
2d04bdd86f Merge pull request #18100 from chancancode/serve_static_files
Allow static asset serving from env variable (enhanced!)
Conflicts:
	railties/CHANGELOG.md
2014-12-19 14:55:34 -08:00
Dan Kang
f369bcf9a0 Default config.assets.digests to true in development 2014-05-17 23:01:22 -04:00
Matthew Draper
4f31b7767e Precompile the image we're referencing, too.
You can't compile a file that references a non-compiled asset's path.

.. unless you turn off asset runtime errors.

Outside of a test case like this, `config.assets.precompile` would
normally retain its default entry, which precompiles all images (and
other non-JS/CSS files) that are in `app/assets`.
2014-04-24 04:49:02 +09:30
Rafael Mendonça França
b053a47b3e depend_on_asset is not required anymore on sprockets-rails 2.1.2 2014-04-09 14:07:31 -03:00
Rafael Mendonça França
bc6a949020 Declare the assets dependency 2014-04-04 18:03:14 -03:00