File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Rails::Controller::Testing
2
2
3
- TODO
3
+ This gem brings back ` assigns() ` to your controller tests as well as ` assert_template `
4
+ to both controller and integration tests.
5
+
6
+ Note: This gem is only useful once ` assigns() ` and ` assert_template ` have been
7
+ removed from Rails.
4
8
5
9
## Installation
6
10
@@ -18,7 +22,31 @@ Or install it yourself as:
18
22
19
23
## Usage
20
24
21
- TODO
25
+ ### assigns()
26
+
27
+ ` assigns() ` allows you to access the instance variables that have been passed to
28
+ your views.
29
+
30
+ ``` ruby
31
+ class PostsController < ActionController ::Base
32
+ def index
33
+ @posts = Post .all
34
+ end
35
+ end
36
+
37
+ class PostControllerTest < ActionController ::TestCase
38
+ def test_index
39
+ get :index
40
+ assert_equal Post .all, assigns(:posts )
41
+ end
42
+ end
43
+ ```
44
+
45
+ ### assert_template
46
+
47
+ ` assert_template ` allows to you assert that certain templates have been rendered.
48
+
49
+ TODO: Provide examples.
22
50
23
51
## Contributing
24
52
You can’t perform that action at this time.
0 commit comments