Skip to content

Commit

Permalink
Merge pull request #234 from tom-at-bowntie/pow_assent_update_phoenix…
Browse files Browse the repository at this point in the history
…_range

Incremented maximum allowable phoenix version to 1.8.0
  • Loading branch information
danschultzer committed Mar 21, 2023
2 parents afa2432 + acd979a commit e2638d1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.4.15 (TBA)

Now supports Phoenix 1.7.

## v0.4.14 (2023-01-22)

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

if Mix.env == :test do
import_config "test.exs"
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :pow_assent, PowAssent.Test.Ecto.Repo,
database: "pow_assent_test",
Expand Down
5 changes: 3 additions & 2 deletions lib/pow_assent/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ defmodule PowAssent.Config do
|> get_provider_config(provider)
|> deep_merge(new_provider_config)

mod = Keyword.get(provider_config, :strategy)

default_config =
provider_config
|> Keyword.get(:strategy)
|> apply(:default_config, [provider_config])
|> mod.default_config()
|> Keyword.take(Keyword.keys(provider_config))

updated_provider_config = deep_merge(default_config, provider_config)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule PowAssent.MixProject do
{:assent, "~> 0.1.2 or ~> 0.2.0"},

{:ecto, "~> 2.2 or ~> 3.0"},
{:phoenix, ">= 1.3.0 and < 1.7.0"},
{:phoenix, ">= 1.3.0 and < 1.8.0"},
{:phoenix_html, ">= 2.0.0 and <= 4.0.0"},
{:plug, ">= 1.5.0 and < 2.0.0", optional: true},

Expand Down
26 changes: 14 additions & 12 deletions mix.lock

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion test/support/phoenix/conn_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ defmodule PowAssent.Test.Phoenix.ConnCase do
using do
quote do
import Plug.Conn
import Phoenix.ConnTest
import Phoenix.ConnTest, except: [get_flash: 2]
import unquote(__MODULE__), only: [get_flash: 2]

alias Router.Helpers, as: Routes

Expand All @@ -26,4 +27,11 @@ defmodule PowAssent.Test.Phoenix.ConnCase do

{:ok, conn: conn}
end

# TODO: Remove when Phoenix 1.7 is required
if Code.ensure_loaded?(Phoenix.Flash) do
def get_flash(conn, key), do: Phoenix.Flash.get(conn.assigns.flash, key)
else
defdelegate get_flash(conn, key), to: Phoenix.Controller
end
end

0 comments on commit e2638d1

Please sign in to comment.