1
0
Fork 0
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:
Vipul A M 2016-07-02 21:50:49 -07:00
parent 44c7507657
commit 5324665e9f
No known key found for this signature in database
GPG key ID: 4C9362FE1F574587

View file

@ -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)