From 97af8d47bcd83f744d052970a3c1703ec60b92c2 Mon Sep 17 00:00:00 2001 From: Angelika Tyborska Date: Fri, 22 Mar 2024 09:43:35 +0100 Subject: [PATCH] Make tests async again with process dict --- lib/bitstyles_phoenix/bitstyles.ex | 5 ++++- lib/bitstyles_phoenix/showcase.ex | 2 +- test/bitstyles_phoenix/alpine3/dropdown_test.exs | 2 +- test/bitstyles_phoenix/alpine3/sidebar_test.exs | 2 +- test/bitstyles_phoenix/component/badge_test.exs | 2 +- test/bitstyles_phoenix/component/breadcrumbs_test.exs | 2 +- test/bitstyles_phoenix/component/button_test.exs | 2 +- test/bitstyles_phoenix/component/description_list_test.exs | 2 +- test/bitstyles_phoenix/component/dropdown_test.exs | 2 +- test/bitstyles_phoenix/component/error_test.exs | 2 +- test/bitstyles_phoenix/component/flash_test.exs | 2 +- test/bitstyles_phoenix/component/form_test.exs | 2 +- test/bitstyles_phoenix/component/icon_test.exs | 2 +- test/bitstyles_phoenix/component/modal_test.exs | 2 +- 14 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/bitstyles_phoenix/bitstyles.ex b/lib/bitstyles_phoenix/bitstyles.ex index b44462d..3c25aba 100644 --- a/lib/bitstyles_phoenix/bitstyles.ex +++ b/lib/bitstyles_phoenix/bitstyles.ex @@ -92,7 +92,10 @@ defmodule BitstylesPhoenix.Bitstyles do end def version do - Application.get_env(:bitstyles_phoenix, :bitstyles_version, @default_version) + bitstyles_version_override = Process.get(:bitstyles_phoenix_bistyles_version) + + bitstyles_version_override || + Application.get_env(:bitstyles_phoenix, :bitstyles_version, @default_version) end def default_version do diff --git a/lib/bitstyles_phoenix/showcase.ex b/lib/bitstyles_phoenix/showcase.ex index 6a09b97..12a797e 100644 --- a/lib/bitstyles_phoenix/showcase.ex +++ b/lib/bitstyles_phoenix/showcase.ex @@ -141,7 +141,7 @@ defmodule BitstylesPhoenix.Showcase do doctest_expected_results |> Enum.map_join("\n\n", fn {version, expected_result} -> """ - iex> Application.put_env(:bitstyles_phoenix, :bitstyles_version, "#{version}") + iex> Process.put(:bitstyles_phoenix_bistyles_version, "#{version}") #{doctest_iex_code |> String.replace("iex>", "...>")} #{expected_result} """ diff --git a/test/bitstyles_phoenix/alpine3/dropdown_test.exs b/test/bitstyles_phoenix/alpine3/dropdown_test.exs index f9551b2..d46cbab 100644 --- a/test/bitstyles_phoenix/alpine3/dropdown_test.exs +++ b/test/bitstyles_phoenix/alpine3/dropdown_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Alpine3.DropdownTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Alpine3.Dropdown, import: true end diff --git a/test/bitstyles_phoenix/alpine3/sidebar_test.exs b/test/bitstyles_phoenix/alpine3/sidebar_test.exs index cfa4fef..f9af1e0 100644 --- a/test/bitstyles_phoenix/alpine3/sidebar_test.exs +++ b/test/bitstyles_phoenix/alpine3/sidebar_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Alpine3.SidebarTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Alpine3.Sidebar, import: true end diff --git a/test/bitstyles_phoenix/component/badge_test.exs b/test/bitstyles_phoenix/component/badge_test.exs index 4addf2c..47c21a9 100644 --- a/test/bitstyles_phoenix/component/badge_test.exs +++ b/test/bitstyles_phoenix/component/badge_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.BadgeTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Badge end diff --git a/test/bitstyles_phoenix/component/breadcrumbs_test.exs b/test/bitstyles_phoenix/component/breadcrumbs_test.exs index 0f5f58c..57008b7 100644 --- a/test/bitstyles_phoenix/component/breadcrumbs_test.exs +++ b/test/bitstyles_phoenix/component/breadcrumbs_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.BreadcrumbsTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Breadcrumbs end diff --git a/test/bitstyles_phoenix/component/button_test.exs b/test/bitstyles_phoenix/component/button_test.exs index aed91ae..e757446 100644 --- a/test/bitstyles_phoenix/component/button_test.exs +++ b/test/bitstyles_phoenix/component/button_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.ButtonTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Button diff --git a/test/bitstyles_phoenix/component/description_list_test.exs b/test/bitstyles_phoenix/component/description_list_test.exs index 61dcd47..909d81f 100644 --- a/test/bitstyles_phoenix/component/description_list_test.exs +++ b/test/bitstyles_phoenix/component/description_list_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.DescriptionListTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.DescriptionList end diff --git a/test/bitstyles_phoenix/component/dropdown_test.exs b/test/bitstyles_phoenix/component/dropdown_test.exs index 9dadfc6..6c6858f 100644 --- a/test/bitstyles_phoenix/component/dropdown_test.exs +++ b/test/bitstyles_phoenix/component/dropdown_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.DropdownTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Dropdown end diff --git a/test/bitstyles_phoenix/component/error_test.exs b/test/bitstyles_phoenix/component/error_test.exs index 57623a9..c5c8db3 100644 --- a/test/bitstyles_phoenix/component/error_test.exs +++ b/test/bitstyles_phoenix/component/error_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.ErrorTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true import BitstylesPhoenix.Helper.TestFixtures doctest BitstylesPhoenix.Component.Error diff --git a/test/bitstyles_phoenix/component/flash_test.exs b/test/bitstyles_phoenix/component/flash_test.exs index 4d46254..1e83aa1 100644 --- a/test/bitstyles_phoenix/component/flash_test.exs +++ b/test/bitstyles_phoenix/component/flash_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.FlashTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Flash end diff --git a/test/bitstyles_phoenix/component/form_test.exs b/test/bitstyles_phoenix/component/form_test.exs index df77a04..90b13f7 100644 --- a/test/bitstyles_phoenix/component/form_test.exs +++ b/test/bitstyles_phoenix/component/form_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.FormTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true import BitstylesPhoenix.Helper.TestFixtures import Phoenix.Component doctest BitstylesPhoenix.Component.Form diff --git a/test/bitstyles_phoenix/component/icon_test.exs b/test/bitstyles_phoenix/component/icon_test.exs index e61214c..09084e9 100644 --- a/test/bitstyles_phoenix/component/icon_test.exs +++ b/test/bitstyles_phoenix/component/icon_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.IconTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Icon end diff --git a/test/bitstyles_phoenix/component/modal_test.exs b/test/bitstyles_phoenix/component/modal_test.exs index 221e701..f94085f 100644 --- a/test/bitstyles_phoenix/component/modal_test.exs +++ b/test/bitstyles_phoenix/component/modal_test.exs @@ -1,5 +1,5 @@ defmodule BitstylesPhoenix.Component.ModalTest do - use BitstylesPhoenix.ComponentCase, async: false + use BitstylesPhoenix.ComponentCase, async: true doctest BitstylesPhoenix.Component.Modal end