diff --git a/test/click_test.rb b/test/click_test.rb index c15580d..bf2ac91 100644 --- a/test/click_test.rb +++ b/test/click_test.rb @@ -46,12 +46,28 @@ def test_invalid_redirect_url end end - def test_legacy_signature + def test_secret_token_signature + get AhoyEmail::Engine.routes.url_helpers.click_path(c: "test", s: "1xjjEyEbkRSohoe0RpWUYAeDNthXDDNdaKFtCJp5lyg", t: "123", u: "https://example.org") + assert_redirected_to "https://example.org" + end + + def test_legacy_secret_token_signature + get AhoyEmail::Engine.routes.url_helpers.click_path(c: "test", s: "ncBvGv-Q804GPmVf1JzHm767cx4CmGLrc1mwR0KFnLY", t: "123", u: "https://example.org") + assert_redirected_to "https://example.org" + end + + def test_legacy_secret_token_bad_signature + get AhoyEmail::Engine.routes.url_helpers.click_path(c: "test", s: "bad", t: "123", u: "https://example.org") + assert_response :not_found + assert_equal "Link expired", response.body + end + + def test_legacy_route_signature get AhoyEmail::Engine.routes.url_helpers.click_message_path("123", signature: "d77812b6f1406cff37c4ee6fcfc744b986281c5c", url: "https://example.org") assert_redirected_to "https://example.org" end - def test_legacy_bad_signature + def test_legacy_route_bad_signature get AhoyEmail::Engine.routes.url_helpers.click_message_path("123", signature: "bad", url: "https://example.org") assert_response :not_found assert_equal "Link expired", response.body