diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-04-30 14:51:49 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 14:51:49 +0900 |
commit | 21adf4f4c4f1dc78134c70f610bf999fb88964fb (patch) | |
tree | d85a921bf77d47608529549faa63f7929a8feacc /guides/source | |
parent | 7097514d1e7fdb7e55a9640c9d0646aceced003f (diff) | |
parent | e7ba10b9a913b6e3d1e0f311d12eafa981824bbf (diff) | |
download | rails-21adf4f4c4f1dc78134c70f610bf999fb88964fb.tar.gz rails-21adf4f4c4f1dc78134c70f610bf999fb88964fb.tar.bz2 rails-21adf4f4c4f1dc78134c70f610bf999fb88964fb.zip |
Merge pull request #32756 from houhoulis/fix_example_url_helper_in_testing_guide
Fix url_helper examples in testing guide [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/testing.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md index 3973cf1d23..2c2f1028e1 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -1085,16 +1085,16 @@ The `get` method kicks off the web request and populates the results into the `@ All of these keyword arguments are optional. -Example: Calling the `:show` action, passing an `id` of 12 as the `params` and setting `HTTP_REFERER` header: +Example: Calling the `:show` action for the first `Article`, passing in an `HTTP_REFERER` header: ```ruby -get article_url, params: { id: 12 }, headers: { "HTTP_REFERER" => "http://example.com/home" } +get article_url(Article.first), headers: { "HTTP_REFERER" => "http://example.com/home" } ``` -Another example: Calling the `:update` action, passing an `id` of 12 as the `params` as an Ajax request. +Another example: Calling the `:update` action for the last `Article`, passing in new text for the `title` in `params`, as an Ajax request: ```ruby -patch article_url, params: { id: 12 }, xhr: true +patch article_url(Article.last), params: { article: { title: "updated" } }, xhr: true ``` NOTE: If you try running `test_should_create_article` test from `articles_controller_test.rb` it will fail on account of the newly added model level validation and rightly so. |