Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 30, 2024
1 parent 7cd6312 commit a512d0d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/click_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a512d0d

Please sign in to comment.