mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Expand on Instance variables section with an example and specify when the instance variables are set.[ci skip]
This commit is contained in:
parent
44c7507657
commit
5324665e9f
1 changed files with 14 additions and 1 deletions
|
@ -789,12 +789,25 @@ cookies["are_good_for_u"] cookies[:are_good_for_u]
|
|||
|
||||
### Instance Variables Available
|
||||
|
||||
You also have access to three instance variables in your functional tests:
|
||||
You also have access to three instance variables in your functional tests, after a request is made:
|
||||
|
||||
* `@controller` - The controller processing the request
|
||||
* `@request` - The request object
|
||||
* `@response` - The response object
|
||||
|
||||
|
||||
```ruby
|
||||
class ArticlesControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get index" do
|
||||
get articles_url
|
||||
|
||||
assert_equal "index", @controller.action_name
|
||||
assert_equal "application/x-www-form-urlencoded", @request.media_type
|
||||
assert_match "Articles", @response.body
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### Setting Headers and CGI variables
|
||||
|
||||
[HTTP headers](http://tools.ietf.org/search/rfc2616#section-5.3)
|
||||
|
|
Loading…
Reference in a new issue