I need to create some methods that are available both to my application (models, views and controllers) and to RSpec.
Specifically I need to create some path_helper methods that contain critical logic. I need to make them available to RSpec so that I can run tests like:
controller.should redirect_to my_custom_path_helper(@object)
I presume that they should go somewhere in /lib
however I'm not sure how to structure this (mixin module - if so what should I mix the module into?).
An alternative option would be if I could access Application Helpers from RSpec.
EDIT: Please note
This is not a question about testing helper methods it is about making them accessible to both the application and RSpec.
I need to do this because I need wrapper logic around my rails path_helpers and when I test should redirect_to .._path
in RSpec I don't want to duplicate the logic of those path helpers.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…