aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorChris Houhoulis <chris@chrishouhoulis.com>2018-04-29 19:23:38 -0400
committerChris Houhoulis <chris@chrishouhoulis.com>2018-04-29 20:19:22 -0400
commite7ba10b9a913b6e3d1e0f311d12eafa981824bbf (patch)
treed85a921bf77d47608529549faa63f7929a8feacc /guides
parent7097514d1e7fdb7e55a9640c9d0646aceced003f (diff)
downloadrails-e7ba10b9a913b6e3d1e0f311d12eafa981824bbf.tar.gz
rails-e7ba10b9a913b6e3d1e0f311d12eafa981824bbf.tar.bz2
rails-e7ba10b9a913b6e3d1e0f311d12eafa981824bbf.zip
Fix url_helper examples in testing guide [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/testing.md8
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.