public
Description: cheat sheet repository for chit
Homepage:
Clone URL: git://github.com/robin/chitsheet.git
robin (author)
Wed Jul 09 03:11:05 -0700 2008
commit  4d546432dd5b473dbbb5883f19cacc71b4599483
tree    d2371207000e34eb8ae02337f9e5c2f03ffdd22d
parent  8b2c5772e458466c24b4c2360fcf24e8b3b72468
chitsheet / assert_generates.yml
100644 26 lines (15 sloc) 1.195 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
assert_generates: |
  # 'cheat assertions' for the rest
  
  assert_generates(expected_path, options, defaults={}, extras = {}, message=nil)
  
  Asserts that the provided options can be used to generate the provided path. This is the inverse of assert_recognizes. The extras parameter is used to tell the request the names and values of additional request parameters that would be in a query string. The message parameter allows you to specify a custom error message for assertion failures.
  
  The defaults parameter is unused.
  
  Examples
  
    # Asserts that the default action is generated for a route with no action
    assert_generates("/items", :controller => "items", :action => "index")
  
    # Tests that the list action is properly routed
    assert_generates("/items/list", :controller => "items", :action => "list")
  
    # Tests the generation of a route with a parameter
    assert_generates("/items/list/1", { :controller => "items", :action => "list", :id => "1" })
  
    # Asserts that the generated route gives us our custom route
    assert_generates "changesets/12", { :controller => 'scm', :action => 'show_diff', :revision => "12" }