File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
- # Rspec:: Rails:: Caching
1
+ # RSpec Rails Caching
2
2
3
- TODO: Write a gem description
3
+ Provides a cache store for recording and matchers for testing cache events in Rails controller tests.
4
4
5
5
## Installation
6
6
@@ -18,7 +18,24 @@ Or install it yourself as:
18
18
19
19
## Usage
20
20
21
- TODO: Write usage instructions here
21
+ Add ` caching: true ` as an option around a controller example group and use
22
+ a proc or lambda around the action for matching:
23
+
24
+ describe WidgetsController, caching: true do
25
+ it "should cache the show action" do
26
+ ->{ get :show, id: 123 }.should cache_page('/widgets/123')
27
+ end
28
+
29
+ it "should expire the update action" do
30
+ ->{ put :update, id: 123 }.should expire_page('/widgets/123')
31
+ end
32
+ end
33
+
34
+ ### Available matchers:
35
+
36
+ * ` cache_page ` / ` expire_page `
37
+ * ` cache_fragment ` / ` expire_fragment `
38
+ * ` cache_action ` / ` expire_action `
22
39
23
40
## Contributing
24
41
You can’t perform that action at this time.
0 commit comments