Skip to content

Fix duplicated test names for image pack helpers #2737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ require.context('../images', true)
<% # => <img src="/packs/media/images/calendar-k344a6d59eef8632c9d1.png" /> %>
```

Note you need to add a `media/` prefix (not `/media/`) to any subfolder structure you might have in `app/javascript`. See more examples in the [tests](https://github.com/rails/webpacker/blob/0b86cadb5ed921e2c1538382e72a236ec30a5d97/test/helper_test.rb#L37).
Note you need to add a `media/` prefix (not `/media/`) to any subfolder structure you might have in `app/javascript`. See more examples in the [tests](/test/helper_test.rb#L37).
2 changes: 1 addition & 1 deletion docs/es6.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The comment you see above (`/* webpackChunkName */`) is not arbitrary, it is one
**Warning**: You should not attempt to dynamically load anything from your `packs/` folder. Instead, try to make your `pack` scripts a hub from which you dynamically load `non-pack` scripts.

- [Docs for using magic comments](https://webpack.js.org/api/module-methods/#magic-comments)
- [Docs for configuring `splitChunks` in webpacker](https://github.com/rails/webpacker/blob/master/docs/webpack.md#add-splitchunks-webpack-v4).
- [Docs for configuring `splitChunks` in webpacker](/docs/webpack.md#add-splitchunks-webpack-v4).
- [Docs for using dynamic `import()`](https://webpack.js.org/guides/code-splitting#dynamic-imports).

## Module import vs require()
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ config.public_file_server.enabled = true
Webpacker ships with three javascript configuration files: `test.js`,
`development.js`, and `production.js`. The `NODE_ENV` environment
variable determines which config will be used. `NODE_ENV` is
independent of `RAILS_ENV` and is set to `development` by [default](https://github.com/rails/webpacker/blob/bf278f9787704ed0f78038ad7d36c008abc2edfd/lib/install/bin/webpack#L4).
independent of `RAILS_ENV` and is set to `development` by [default](/lib/install/bin/webpack#L4).
This means that `rails test` or `rspec` will use `development.js`
by default, _not_ `test.js`.

Expand Down
4 changes: 2 additions & 2 deletions test/helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def test_asset_pack_url
end
end

def test_asset_pack_path
def test_image_pack_path
assert_equal "/packs/application-k344a6d59eef8632c9d1.png", image_pack_path("application.png")
assert_equal "/packs/media/images/image-c38deda30895059837cf.jpg", image_pack_path("image.jpg")
assert_equal "/packs/media/images/image-c38deda30895059837cf.jpg", image_pack_path("media/images/image.jpg")
assert_equal "/packs/media/images/nested/image-c38deda30895059837cf.jpg", image_pack_path("nested/image.jpg")
assert_equal "/packs/media/images/nested/image-c38deda30895059837cf.jpg", image_pack_path("media/images/nested/image.jpg")
end

def test_asset_pack_url
def test_image_pack_url
assert_equal "https://example.com/packs/application-k344a6d59eef8632c9d1.png", image_pack_url("application.png")
assert_equal "https://example.com/packs/media/images/image-c38deda30895059837cf.jpg", image_pack_url("image.jpg")
assert_equal "https://example.com/packs/media/images/image-c38deda30895059837cf.jpg", image_pack_url("media/images/image.jpg")
Expand Down