I am using a xhr :post to interact with a controller, and I am expecting a redirect. In the js.erb i have window.location.href = address . Testing it manually, the browser gets redirected properly. How can i test it using RSpec? response.should redirect_to fails
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- Question marks after images and js/css files in ra
- void before promise syntax
- Keeping track of variable instances
I solved this particular problem inspecting the response body generated by the js.erb
Because it didn't feel right, I will accept my own asnwer as long as it gets upvoted.
This won't work with RSpec -- it does not execute Javascript. You'll need another testing tool -- some good suggestions in this blog post.