I wanted to test rjs redirection:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assert_select_rjs :redirect_to, '/' |
Problem:
ActionController::Assertions::SelectorAssertions#assert_select_rjs
don't know about :redirect_to
Solution:
I don't know if this is the right solution but I added this at the end of my
test_helper.rb
then I can assert by :redirect_to
now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionController::Assertions::SelectorAssertions | |
RJS_STATEMENTS[:redirect_to] = "window\\.location\\.href = #{RJS_ANY_ID}" | |
end |