In a view spec Rails 4 Rspec-Rails 3 cannot stub method on view


0 votes
asked Mar 14, 2016 by OehrleAs (700 points)
I try to stub helper method in view spec in Rails 4

4 Answers

0 votes
answered Jun 1, 2016 by Wenona_to (660 points)
selected Jun 3, 2016 by Youd_3457
 
Best answer
I found this simple solution while working on this. The issue and the patch can be found at Mocking/stubbing an ApplicationHelper method in a view ...
+2 votes
answered May 6, 2016 by Pettiway (220 points)
It should be includedif the spec file is in spec/helpers. It works when viewing that template in the browser.
Please post the spec so we can see what's going on. Please post the spec so wecan see what's going on.
commented May 8, 2016 by Implementa (1,170 points)
You can also download the source code from here
commented May 8, 2016 by prashad_1 (270 points)
This is useful when you want to have a global variable
0 votes
answered May 23, 2016 by gur_2761_t (190 points)
For the very beginner Stub a controllers helper_method in a view template helper ... is also a nice one
But be cautious of any indexes that may be on these columns
0 votes
answered Jun 1, 2016 by Mullinax (160 points)
I have tested several of them and at this moment the only one that supports
The code is available at [rspec-users] Stub a controllers helper_method in a view ...

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!







...