Skip to content

Commit 28eb8b4

Browse files
authored
Add assert_redirected_to test with custom message
1 parent 32ea85f commit 28eb8b4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

actionpack/test/controller/action_pack_assertions_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,14 @@ def test_assert_redirection_with_symbol
442442
}
443443
end
444444

445+
def test_assert_redirection_with_custom_message
446+
error = assert_raise(ActiveSupport::TestCase::Assertion) do
447+
assert_redirected_to "http://test.host/some/path", "wrong redirect"
448+
end
449+
450+
assert_equal("wrong redirect", error.message)
451+
end
452+
445453
def test_assert_redirection_with_status
446454
process :redirect_to_path
447455
assert_redirected_to "http://test.host/some/path", status: :found

0 commit comments

Comments
 (0)