Skip to content

Commit

Permalink
Fix duplicated test names for image pack helpers and use github relat…
Browse files Browse the repository at this point in the history
…ive links in docs (#2737)
  • Loading branch information
SampsonCrowley authored Sep 22, 2020
1 parent 5f70b39 commit d050682
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
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

0 comments on commit d050682

Please sign in to comment.