Skip to content

Commit 1736d52

Browse files
committed
Updated README documentation
1 parent 2a14de4 commit 1736d52

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Rspec::Rails::Caching
1+
# RSpec Rails Caching
22

3-
TODO: Write a gem description
3+
Provides a cache store for recording and matchers for testing cache events in Rails controller tests.
44

55
## Installation
66

@@ -18,7 +18,24 @@ Or install it yourself as:
1818

1919
## Usage
2020

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`
2239

2340
## Contributing
2441

0 commit comments

Comments
 (0)