I have a helper module with a method that fires off redirect_to if the current user does not have permission to visit a web page.
I am getting a NoMethodError error when running the tests, since the helper does not actually have a redirect_to method. I have tried stubbing out redirect_to like this:
it "redirects the user to the user's langing page if the user doesn't have permission" do
allow(helper).to receive(:current_or_guest_user) { test_user }
expect(helper).to receive(:redirect_to)
helper.require_permission :view_admins
end
but I get a long long error that the helper does not implement redirect_to.
Is there a way to stub out this method?
Aucun commentaire:
Enregistrer un commentaire