Last active
October 31, 2017 15:20
-
-
Save pixeltrix/81746e2f61e264e3fd284c9bdbce85c3 to your computer and use it in GitHub Desktop.
Assert redirect helper for Turbolinks (untested code)
This file contains hidden or 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 TurbolinksHelpers | |
def assert_turbolinks_redirected_to(options = {}, message = nil) | |
assert_response(:success, message) | |
assert_equal("text/javascript", @response.content_type) | |
redirect_is = @response.body[/Turbolinks.visit\("([^"]+)/, 1] | |
redirect_expected = normalize_argument_to_redirection(options) | |
assert_operator redirect_expected, :===, redirect_is, message | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment