diff options
author | Zachary Scott <e@zzak.io> | 2014-11-13 11:51:36 -0800 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2014-11-13 11:51:36 -0800 |
commit | 796abe2339dada1b50fcde99c01db9e96104161c (patch) | |
tree | 97f5433e5b06253c7ecc964718f0c03e13f74f14 | |
parent | 77ed79b84204f56802b2e9e093d47fd2a7a6ca21 (diff) | |
parent | 062988efd31a0588b07a45d633ea6a8f46c884a6 (diff) | |
download | rails-796abe2339dada1b50fcde99c01db9e96104161c.tar.gz rails-796abe2339dada1b50fcde99c01db9e96104161c.tar.bz2 rails-796abe2339dada1b50fcde99c01db9e96104161c.zip |
Merge branch 'sandipransing-master'
-rw-r--r-- | guides/source/testing.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md index ce815156a7..79e7ac5aef 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -82,7 +82,7 @@ Each fixture is given a name followed by an indented list of colon-separated key If you are working with [associations](/association_basics.html), you can simply define a reference node between two different fixtures. Here's an example with -a belongs_to/has_many association: +a `belongs_to`/`has_many` association: ```yaml # In fixtures/categories.yml @@ -901,13 +901,17 @@ end Testing Routes -------------- -Like everything else in your Rails application, it is recommended that you test your routes. An example test for a route in the default `show` action of `Articles` controller above should look like: +Like everything else in your Rails application, it is recommended that you test your routes. Below are example tests for the routes of default `show` and `create` action of `Articles` controller above and it should look like: ```ruby class ArticleRoutesTest < ActionController::TestCase test "should route to article" do assert_routing '/articles/1', { controller: "articles", action: "show", id: "1" } end + + test "should route to create article" do + assert_routing({ method: 'post', path: '/articles' }, { controller: "articles", action: "create" }) + end end ``` |