提交 b36f123d 编写于 作者: C Claudius Nicolae

Explicit route test class

shows the class that the test must extend in order to have the assert_routing method available
上级 4e8ea13b
......@@ -904,8 +904,10 @@ 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:
```ruby
test "should route to article" do
assert_routing '/articles/1', {controller: "articles", action: "show", id: "1"}
class ArticleRoutesTest < ActionController::TestCase
test "should route to article" do
assert_routing '/articles/1', { controller: "articles", action: "show", id: "1" }
end
end
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册