Skip to content

Commit

Permalink
refactor: Clean up Credo and formatter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
doomspork committed Sep 30, 2024
1 parent 381d257 commit f6b89f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/bamboo/adapters/send_grid_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ defmodule Bamboo.SendGridHelper do
|> with_bypass_unsubscribe_management(true)
"""
def with_bypass_unsubscribe_management(email, enabled) when is_boolean(enabled) do
email
|> Email.put_private(@bypass_unsubscribe_management, enabled)
Email.put_private(email, @bypass_unsubscribe_management, enabled)
end

def with_bypass_unsubscribe_management(_email, enabled) do
Expand Down
1 change: 0 additions & 1 deletion test/lib/bamboo/adapters/send_grid_adapter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ defmodule Bamboo.SendGridAdapterTest do
assert params["mail_settings"]["bypass_list_management"]["enable"] == true
end


test "deliver/2 correctly handles a bypass_unsubscribe_management" do
email =
new_email(
Expand Down
5 changes: 2 additions & 3 deletions test/lib/bamboo/adapters/send_grid_helper_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,14 @@ defmodule Bamboo.SendGridHelperTest do
end
end


test "with_bypass_unsubscribe_management/2 adds the correct property", %{email: email} do
email = email |> with_bypass_unsubscribe_management(true)
email = with_bypass_unsubscribe_management(email, true)
assert email.private[:bypass_unsubscribe_management] == true
end

test "with_bypass_unsubscribe_management/2 raises on non-boolean parameter", %{email: email} do
assert_raise RuntimeError, fn ->
email |> with_bypass_unsubscribe_management(1)
with_bypass_unsubscribe_management(email, 1)
end
end

Expand Down

0 comments on commit f6b89f0

Please sign in to comment.