aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/testing.md
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2016-07-02 21:50:49 -0700
committerVipul A M <vipulnsward@gmail.com>2016-07-02 21:50:49 -0700
commit5324665e9f8a6104c79c7798b3e264db2b42c6d7 (patch)
tree48aaaaa77f83e4ade96b432a1b95ee670c3843b0 /guides/source/testing.md
parent44c7507657e2aed924749f3a3cdb527c845a048f (diff)
downloadrails-5324665e9f8a6104c79c7798b3e264db2b42c6d7.tar.gz
rails-5324665e9f8a6104c79c7798b3e264db2b42c6d7.tar.bz2
rails-5324665e9f8a6104c79c7798b3e264db2b42c6d7.zip
Expand on Instance variables section with an example and specify when the instance variables are set.[ci skip]
Diffstat (limited to 'guides/source/testing.md')
-rw-r--r--guides/source/testing.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md
index d4a826cee5..393f3df6ec 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -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)