Skip to content

Commit

Permalink
Added test for legacy signature
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 30, 2024
1 parent d129e7b commit d1bb229
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/click_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ def test_invalid_redirect_url
end
end

def test_legacy_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
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
end

def test_mailto
message = ClickMailer.mailto.deliver_now
assert_body '<a href="mailto:[email protected]">', message
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ def mongoid?

Combustion.initialize! :action_mailer, :action_controller do
config.load_defaults Rails::VERSION::STRING.to_f
config.secret_key_base = "0" * 128
config.autoload_paths << File.expand_path("support/mongoid_models", __dir__)
config.logger = $logger
end
else
Combustion.initialize! :action_mailer, :action_controller, :active_record do
config.load_defaults Rails::VERSION::STRING.to_f
config.secret_key_base = "0" * 128
config.logger = $logger
end
end
Expand Down

0 comments on commit d1bb229

Please sign in to comment.