Browse files

Document how to stub route helper functions in isolated tests. Addres…

…ses #506.
  • Loading branch information...
1 parent 18e27a5 commit dbe8a81ca7d4d9ae87b4b62926a0ba6379397fbc Carol Nichols committed Apr 5, 2013
Showing with 21 additions and 0 deletions.
  1. +21 −0
@@ -390,6 +390,27 @@ Draper::ViewContext.test_strategy :fast do
+#### Stubbing route helper functions
+If you are writing isolated tests for Draper methods that call route helper
+methods, you can stub them instead of needing to include Rails.
+To get access to the Draper `helpers` in your test, include them in your tests:
+describe YourDecorator do
+ include Draper::ViewHelpers
+Then you can stub the specific route helper functions you need using your
+preferred stubbing technique (this example uses mocha):
+helpers.stubs(users_path: '/users')
## Advanced usage
### Shared Decorator Methods

0 comments on commit dbe8a81

Please sign in to comment.