Skip to content

Commit

Permalink
Section about testing xhr requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kirs committed Jan 3, 2015
1 parent 4b9dba9 commit 1ffd1a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions guides/source/testing.md
Expand Up @@ -528,6 +528,19 @@ All of request types have equivalent methods that you can use. In a typical C.R.

NOTE: Functional tests do not verify whether the specified request type is accepted by the action, we're more concerned with the result. Request tests exist for this use case to make your tests more purposeful.
### Testing XHR (AJAX) requests
`xhr` accepts method (listed in the section above), action name and parameters:
```ruby
test "ajax request responds with no layout" do
xhr :get, :show, id: articles(:first).id
assert_template :index
assert_template layout: nil
end
```
### The Four Hashes of the Apocalypse
After a request has been made and processed, you will have 4 Hash objects ready for use:
Expand Down

0 comments on commit 1ffd1a3

Please sign in to comment.