From 5ed98bf5a90eafd9a67640df27dc128248ddcde1 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Wed, 16 Nov 2022 14:36:05 -0500 Subject: [PATCH] fix: don't use `live_redirect` anywhere because we care about the session improvement: setup CI --- .check.exs | 3 +- .github/CODE_OF_CONDUCT.md | 76 +++++++++++++++++++ .github/CONTRIBUTING.md | 2 + .github/PULL_REQUEST_TEMPLATE.md | 4 + .github/workflows/elixir.yml | 71 +++++++++++++++++ lib/ash_hq/blog/blog.ex | 1 + lib/ash_hq/blog/registry.ex | 1 + lib/ash_hq/blog/resources/comment/comment.ex | 33 -------- lib/ash_hq/blog/resources/post/post.ex | 7 +- lib/ash_hq/blog/resources/post/tag.ex | 1 + lib/ash_hq/calculations/decrypt.ex | 1 + .../transformers/add_search_structure.ex | 1 + lib/ash_hq/docs/importer/importer.ex | 2 +- lib/ash_hq/types/encrypted_string.ex | 1 + lib/ash_hq/vault.ex | 1 + lib/ash_hq_web/components/app_view/top_bar.ex | 17 +++-- lib/ash_hq_web/components/blog/tag.ex | 1 + lib/ash_hq_web/components/catalogue.ex | 1 + lib/ash_hq_web/components/catalogue_modal.ex | 2 +- lib/ash_hq_web/components/doc_sidebar.ex | 6 +- .../components/doc_sidebar_dsl_items.ex | 4 +- lib/ash_hq_web/components/docs/doc_path.ex | 1 + lib/ash_hq_web/components/docs/functions.ex | 1 + lib/ash_hq_web/components/docs/source_link.ex | 1 + lib/ash_hq_web/components/search.ex | 20 +++-- lib/ash_hq_web/components/tree_view.ex | 14 ++-- lib/ash_hq_web/doc_routes.ex | 2 +- lib/ash_hq_web/helpers.ex | 4 +- lib/ash_hq_web/pages/docs.ex | 59 +++++++------- lib/ash_hq_web/pages/log_in.ex | 6 +- lib/ash_hq_web/pages/register.ex | 4 +- lib/ash_hq_web/pages/reset_password.ex | 4 +- lib/ash_hq_web/schema.ex | 3 +- lib/ash_hq_web/views/app_view_live.ex | 39 +++++----- mix.lock | 8 -- .../20221031143406_migrate_resources30.exs | 74 +++++++++--------- .../20221103150903_migrate_resources32.exs | 6 +- .../user_session_controller_test.exs | 6 +- .../user_settings_controller_test.exs | 3 +- test/live/settings_test.exs | 4 +- test/support/fixtures/accounts_fixtures.ex | 4 +- 41 files changed, 312 insertions(+), 187 deletions(-) create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/elixir.yml delete mode 100644 lib/ash_hq/blog/resources/comment/comment.ex diff --git a/.check.exs b/.check.exs index 5c712d6..4a72fcd 100644 --- a/.check.exs +++ b/.check.exs @@ -14,6 +14,7 @@ # {:my_mix_task, command: "mix release", env: %{"MIX_ENV" => "prod"}}, # {:my_arbitrary_tool, command: "npm test", cd: "assets"}, # {:my_arbitrary_script, command: ["my_script", "argument with spaces"], cd: "scripts"} - {:npm_test, false} + {:npm_test, false}, + {:check_migrations, command: "mix ash_postgres.generate_migrations --check"} ] ] diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..7aa6f74 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at zach@zachdaniel.dev. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..f537454 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,2 @@ +# Contributing Guidelines +Contributing guidelines can be found in the core project, [ash](https://github.com/ash-project/ash/blob/main/.github/CONTRIBUTING.md) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8c13744 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,4 @@ +### Contributor checklist + +- [ ] Bug fixes include regression tests +- [ ] Features include unit/acceptance tests diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml new file mode 100644 index 0000000..5b8dfed --- /dev/null +++ b/.github/workflows/elixir.yml @@ -0,0 +1,71 @@ +name: Elixir CI +on: + push: + branches: [main] + tags-ignore: ["v*"] + pull_request: + branches: [main] + create: + branches: main + tags: ["v*"] +jobs: + build: + runs-on: ubuntu-latest + name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} / Ash ${{matrix.ash}} + strategy: + fail-fast: false + matrix: + otp: ["25"] + elixir: ["1.14.0"] + ash: ["2.4.2"] + pg_version: ["13"] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ASH_VERSION: ${{matrix.ash}} + services: + pg: + image: postgres:${{ matrix.pg_version }} + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + ports: ["5432:5432"] + steps: + - run: sudo apt-get install --yes erlang-dev + - uses: actions/checkout@v2 + - uses: erlef/setup-elixir@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - uses: actions/cache@v2 + id: cache-deps + with: + path: deps + key: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + restore-keys: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2 + - uses: actions/cache@v2 + id: cache-build + with: + path: _build + key: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-2-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + restore-keys: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-2 + - run: mix deps.get + - run: mix test.create + - run: mix test.migrate + - run: mix test.migrate_tenants + - run: mix check --except dialyzer + if: startsWith(github.ref, 'refs/tags/v') + - run: mix check + if: "!startsWith(github.ref, 'refs/tags/v')" + release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + name: Release + needs: [build] + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + steps: + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only diff --git a/lib/ash_hq/blog/blog.ex b/lib/ash_hq/blog/blog.ex index b736959..eeb334b 100644 --- a/lib/ash_hq/blog/blog.ex +++ b/lib/ash_hq/blog/blog.ex @@ -1,4 +1,5 @@ defmodule AshHq.Blog do + @moduledoc "An api for interacting with the blog" use Ash.Api, extensions: [AshAdmin.Api] diff --git a/lib/ash_hq/blog/registry.ex b/lib/ash_hq/blog/registry.ex index 01f6ad8..c48c31f 100644 --- a/lib/ash_hq/blog/registry.ex +++ b/lib/ash_hq/blog/registry.ex @@ -1,4 +1,5 @@ defmodule AshHq.Blog.Registry do + @moduledoc "The resources used in the blog" use Ash.Registry, extensions: [Ash.Registry.ResourceValidations] diff --git a/lib/ash_hq/blog/resources/comment/comment.ex b/lib/ash_hq/blog/resources/comment/comment.ex deleted file mode 100644 index f8bb230..0000000 --- a/lib/ash_hq/blog/resources/comment/comment.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule AshHq.Blog.Comment do - use Ash.Resource, - data_layer: AshPostgres.DataLayer, - extensions: [AshHq.Docs.Extensions.RenderMarkdown] - - render_markdown do - render_attributes text: :text_html - end - - postgres do - table "comments" - repo AshHq.Repo - end - - attributes do - uuid_primary_key :id - - attribute :text, :string do - allow_nil? false - end - - attribute :text_html, :string do - allow_nil? false - end - end - - relationships do - belongs_to :author, AshHq.Accounts.User do - allow_nil? false - api AshHq.Accounts - end - end -end diff --git a/lib/ash_hq/blog/resources/post/post.ex b/lib/ash_hq/blog/resources/post/post.ex index eab8b3b..3c07610 100644 --- a/lib/ash_hq/blog/resources/post/post.ex +++ b/lib/ash_hq/blog/resources/post/post.ex @@ -1,4 +1,5 @@ defmodule AshHq.Blog.Post do + @moduledoc "A blog post. Uses the AshBlog data layer and therefore is static" use Ash.Resource, otp_app: :ash_hq, data_layer: AshBlog.DataLayer, @@ -24,10 +25,10 @@ defmodule AshHq.Blog.Post do filter expr( state == :published and - if not is_nil(^arg(:tag)) do - ^arg(:tag) in tag_names - else + if is_nil(^arg(:tag)) do true + else + ^arg(:tag) in tag_names end ) end diff --git a/lib/ash_hq/blog/resources/post/tag.ex b/lib/ash_hq/blog/resources/post/tag.ex index d62f610..e97adae 100644 --- a/lib/ash_hq/blog/resources/post/tag.ex +++ b/lib/ash_hq/blog/resources/post/tag.ex @@ -1,4 +1,5 @@ defmodule AshHq.Blog.Tag do + @moduledoc "A tag that can be applied to a post. Currently uses CSV data layer and therefore is static" use Ash.Resource, data_layer: AshCsv.DataLayer diff --git a/lib/ash_hq/calculations/decrypt.ex b/lib/ash_hq/calculations/decrypt.ex index d362501..99937ab 100644 --- a/lib/ash_hq/calculations/decrypt.ex +++ b/lib/ash_hq/calculations/decrypt.ex @@ -1,4 +1,5 @@ defmodule AshHq.Calculations.Decrypt do + @moduledoc "Decrypts a given value on demand" use Ash.Calculation def decrypt(field) do diff --git a/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex b/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex index afe812f..b247daf 100644 --- a/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex +++ b/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex @@ -52,6 +52,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do |> add_match_rank_calculation(config)} end + # sobelow_skip ["DOS.BinToAtom"] defp add_additional_html_calculations(dsl_state, config) do dsl_state |> Transformer.get_option([:render_markdown], :render_attributes) diff --git a/lib/ash_hq/docs/importer/importer.ex b/lib/ash_hq/docs/importer/importer.ex index 81cbf86..9a51653 100644 --- a/lib/ash_hq/docs/importer/importer.ex +++ b/lib/ash_hq/docs/importer/importer.ex @@ -18,7 +18,7 @@ defmodule AshHq.Docs.Importer do {:ok, %{}} end - defp import_periodically() do + defp import_periodically do __MODULE__.import() Process.send_after(self(), :import, :timer.minutes(30)) end diff --git a/lib/ash_hq/types/encrypted_string.ex b/lib/ash_hq/types/encrypted_string.ex index 4832b96..cfdd733 100644 --- a/lib/ash_hq/types/encrypted_string.ex +++ b/lib/ash_hq/types/encrypted_string.ex @@ -1,4 +1,5 @@ defmodule AshHq.Types.EncryptedString do + @moduledoc "Represents a string that is encrypted when cast as input" use Ash.Type @impl true diff --git a/lib/ash_hq/vault.ex b/lib/ash_hq/vault.ex index 78a8734..6fd4842 100644 --- a/lib/ash_hq/vault.ex +++ b/lib/ash_hq/vault.ex @@ -1,4 +1,5 @@ defmodule AshHq.Vault do + @moduledoc "The encryptor/decryptor, backed by the `cloak` dependency" use Cloak.Vault, otp_app: :ash_hq @impl GenServer diff --git a/lib/ash_hq_web/components/app_view/top_bar.ex b/lib/ash_hq_web/components/app_view/top_bar.ex index 5bb1758..9d03328 100644 --- a/lib/ash_hq_web/components/app_view/top_bar.ex +++ b/lib/ash_hq_web/components/app_view/top_bar.ex @@ -1,4 +1,5 @@ defmodule AshHqWeb.Components.AppView.TopBar do + @moduledoc "The global top navigation bar" use Surface.Component prop live_action, :atom, required: true @@ -7,10 +8,9 @@ defmodule AshHqWeb.Components.AppView.TopBar do prop current_user, :any alias AshHqWeb.Components.SearchBar - alias Surface.Components.LiveRedirect - alias Phoenix.LiveView.JS alias AshHqWeb.Router.Helpers, as: Routes - alias Surface.Components.Form + alias Phoenix.LiveView.JS + alias Surface.Components.{Form, LivePatch} def render(assigns) do ~F""" @@ -18,7 +18,8 @@ defmodule AshHqWeb.Components.AppView.TopBar do id="top-bar" class={ "flex justify-between items-center py-4 px-4 h-20 sticky top-0 z-50", - "border-b border-base-light-300 dark:border-base-dark-700 bg-white dark:bg-base-dark-850": @live_action == :docs_dsl + "border-b border-base-light-300 dark:border-base-dark-700 bg-white dark:bg-base-dark-850": + @live_action == :docs_dsl } >
@@ -132,13 +133,13 @@ defmodule AshHqWeb.Components.AppView.TopBar do {#if @current_user}
- Settings - +
@@ -156,7 +157,7 @@ defmodule AshHqWeb.Components.AppView.TopBar do
{#else}
- @@ -164,7 +165,7 @@ defmodule AshHqWeb.Components.AppView.TopBar do Sign In
- +
{/if} diff --git a/lib/ash_hq_web/components/blog/tag.ex b/lib/ash_hq_web/components/blog/tag.ex index 29b8a8e..4fce419 100644 --- a/lib/ash_hq_web/components/blog/tag.ex +++ b/lib/ash_hq_web/components/blog/tag.ex @@ -1,4 +1,5 @@ defmodule AshHqWeb.Components.Blog.Tag do + @moduledoc "Renders a pill-style tag" use Surface.Component alias Surface.Components.LivePatch diff --git a/lib/ash_hq_web/components/catalogue.ex b/lib/ash_hq_web/components/catalogue.ex index 366d59b..de58c44 100644 --- a/lib/ash_hq_web/components/catalogue.ex +++ b/lib/ash_hq_web/components/catalogue.ex @@ -1,4 +1,5 @@ defmodule AshHqWeb.Components.Catalogue do + @moduledoc "Renders the catalogue of available packages" use Surface.Component alias AshHqWeb.Components.CalloutText diff --git a/lib/ash_hq_web/components/catalogue_modal.ex b/lib/ash_hq_web/components/catalogue_modal.ex index 7d10ae0..0bce0b7 100644 --- a/lib/ash_hq_web/components/catalogue_modal.ex +++ b/lib/ash_hq_web/components/catalogue_modal.ex @@ -14,7 +14,7 @@ defmodule AshHqWeb.Components.CatalogueModal do - Already Have an account? + Already Have an account? """ diff --git a/lib/ash_hq_web/pages/reset_password.ex b/lib/ash_hq_web/pages/reset_password.ex index 200139c..c75b86b 100644 --- a/lib/ash_hq_web/pages/reset_password.ex +++ b/lib/ash_hq_web/pages/reset_password.ex @@ -2,7 +2,7 @@ defmodule AshHqWeb.Pages.ResetPassword do @moduledoc "Log in page" use Surface.LiveComponent - alias Surface.Components.{Form, LiveRedirect} + alias Surface.Components.{Form, LivePatch} alias Surface.Components.Form.{ ErrorTag, @@ -107,7 +107,7 @@ defmodule AshHqWeb.Pages.ResetPassword do - Remember your password? + Remember your password? {/if} diff --git a/lib/ash_hq_web/schema.ex b/lib/ash_hq_web/schema.ex index 4897a2f..e1c5339 100644 --- a/lib/ash_hq_web/schema.ex +++ b/lib/ash_hq_web/schema.ex @@ -1,4 +1,5 @@ defmodule AshHqWeb.Schema do + @moduledoc "The absinthe graphql schema" use Absinthe.Schema @apis [AshHq.Docs] @@ -15,7 +16,7 @@ defmodule AshHqWeb.Schema do AshGraphql.add_context(ctx, @apis) end - def plugins() do + def plugins do [Absinthe.Middleware.Dataloader | Absinthe.Plugin.defaults()] end end diff --git a/lib/ash_hq_web/views/app_view_live.ex b/lib/ash_hq_web/views/app_view_live.ex index cb3adc5..0beaeaf 100644 --- a/lib/ash_hq_web/views/app_view_live.ex +++ b/lib/ash_hq_web/views/app_view_live.ex @@ -3,30 +3,31 @@ defmodule AshHqWeb.AppViewLive do use Surface.LiveView, container: {:div, class: "h-full"} - alias AshHqWeb.Components.{CatalogueModal, Search} alias AshHqWeb.Components.AppView.TopBar + alias AshHqWeb.Components.{CatalogueModal, Search} alias AshHqWeb.Pages.{Blog, Docs, Home, LogIn, Register, ResetPassword, UserSettings} alias Phoenix.LiveView.JS alias Surface.Components.Context require Ash.Query - data(configured_theme, :string, default: :system) - data(searching, :boolean, default: false) - data(selected_versions, :map, default: %{}) - data(libraries, :list, default: []) - data(selected_types, :map, default: %{}) - data(current_user, :map) + import Tails - data(library, :any, default: nil) - data(extension, :any, default: nil) - data(docs, :any, default: nil) - data(library_version, :any, default: nil) - data(guide, :any, default: nil) - data(doc_path, :list, default: []) - data(dsls, :list, default: []) - data(dsl, :any, default: nil) - data(options, :list, default: []) - data(module, :any, default: nil) + data configured_theme, :string, default: :system + data selected_versions, :map, default: %{} + data libraries, :list, default: [] + data selected_types, :map, default: %{} + data current_user, :map + + data library, :any, default: nil + data extension, :any, default: nil + data docs, :any, default: nil + data library_version, :any, default: nil + data guide, :any, default: nil + data doc_path, :list, default: [] + data dsls, :list, default: [] + data dsl, :any, default: nil + data options, :list, default: [] + data module, :any, default: nil def render(%{platform: :ios} = assigns) do ~F""" @@ -41,7 +42,7 @@ defmodule AshHqWeb.AppViewLive do ~F"""
push_event("set_theme", %{theme: theme})} end - def mount(params, session, socket) do + def mount(_params, session, socket) do socket = assign_new(socket, :user_agent, fn _assigns -> get_connect_params(socket)["user_agent"] diff --git a/mix.lock b/mix.lock index e1f0f1f..8ee2468 100644 --- a/mix.lock +++ b/mix.lock @@ -7,7 +7,6 @@ "ash_csv": {:git, "https://github.com/ash-project/ash_csv.git", "bad0f6961bf5d135450dacda687d9df0549e80ae", []}, "ash_graphql": {:git, "https://github.com/ash-project/ash_graphql.git", "fb7b60f9e1793c912e238043aa115cd6585c19b7", []}, "ash_json_api": {:git, "https://github.com/ash-project/ash_json_api.git", "2525172e72d0e8b0e369155f32e5edfbf25b9691", []}, - "ash_paper_trail": {:git, "https://github.com/ash-project/ash_paper_trail.git", "e6928944b51fd768d27cbb2ef80fb7864aaab46d", []}, "ash_phoenix": {:git, "https://github.com/ash-project/ash_phoenix.git", "5ffcd1916ece639c684273e632cc0aecebe82f26", []}, "ash_postgres": {:hex, :ash_postgres, "1.1.1", "2bbc2b39d9e387f89b964b29b042f88dd352b71e486d9aea7f9390ab1db3ced4", [:mix], [{:ash, "~> 2.1", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "fe47a6e629b6b23ce17c1d70b1bd4b3fd732df513b67126514fb88be86a6439e"}, "bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"}, @@ -15,7 +14,6 @@ "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "cloak": {:hex, :cloak, "1.1.2", "7e0006c2b0b98d976d4f559080fabefd81f0e0a50a3c4b621f85ceeb563e80bb", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "940d5ac4fcd51b252930fd112e319ea5ae6ab540b722f3ca60a85666759b9585"}, - "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"}, "comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, @@ -35,7 +33,6 @@ "ecto": {:hex, :ecto, "3.9.1", "67173b1687afeb68ce805ee7420b4261649d5e2deed8fe5550df23bab0bc4396", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c80bb3d736648df790f7f92f81b36c922d9dd3203ca65be4ff01d067f54eb304"}, "ecto_psql_extras": {:hex, :ecto_psql_extras, "0.7.4", "5d43fd088d39a158c860b17e8d210669587f63ec89ea122a4654861c8c6e2db4", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.15.7", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.1.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "311db02f1b772e3d0dc7f56a05044b5e1499d78ed6abf38885e1ca70059449e5"}, "ecto_sql": {:hex, :ecto_sql, "3.9.0", "2bb21210a2a13317e098a420a8c1cc58b0c3421ab8e3acfa96417dab7817918c", [:mix], [{:db_connection, "~> 2.5 or ~> 2.4.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a8f3f720073b8b1ac4c978be25fa7960ed7fd44997420c304a4a2e200b596453"}, - "eflambe": {:git, "https://github.com/DockYard/flame_on.git", "3f4e3bfa2e5546d95fb94d7ecb4b459bc4398c41", []}, "eflame": {:hex, :eflame, "1.0.1", "0664d287e39eef3c413749254b3af5f4f8b00be71c1af67d325331c4890be0fc", [:mix], [], "hexpm", "e0b08854a66f9013129de0b008488f3411ae9b69b902187837f994d7a99cf04e"}, "elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, "elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "85d4a87d216678dae30f348270eb90f9ed49ce20", [ref: "85d4a87d216678dae30f348270eb90f9ed49ce20"]}, @@ -47,7 +44,6 @@ "excoveralls": {:hex, :excoveralls, "0.14.6", "610e921e25b180a8538229ef547957f7e04bd3d3e9a55c7c5b7d24354abbba70", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "0eceddaa9785cfcefbf3cd37812705f9d8ad34a758e513bb975b081dce4eb11e"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "finch": {:hex, :finch, "0.10.2", "9ad27d68270d879f73f26604bb2e573d40f29bf0e907064a9a337f90a16a0312", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dd8b11b282072cec2ef30852283949c248bd5d2820c88d8acc89402b81db7550"}, - "flame_on": {:hex, :flame_on, "0.5.2", "31b3f417418f49956e7f8c9b10098ecadc2d529d7a2fcaf17bbe65d78462d763", [:mix], [{:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}, {:phoenix_ecto, "~> 4.4", [hex: :phoenix_ecto, repo: "hexpm", optional: false]}, {:phoenix_live_dashboard, "~> 0.6.4", [hex: :phoenix_live_dashboard, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.6", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "552b0013640089d07ae03bee93c6c3f0803adf1a001138ee7ec06e72b7da3756"}, "floki": {:hex, :floki, "0.33.1", "f20f1eb471e726342b45ccb68edb9486729e7df94da403936ea94a794f072781", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "461035fd125f13fdf30f243c85a0b1e50afbec876cbf1ceefe6fddd2e6d712c6"}, "getopt": {:hex, :getopt, "1.0.1", "c73a9fa687b217f2ff79f68a3b637711bb1936e712b521d8ce466b29cbf7808a", [:rebar3], [], "hexpm", "53e1ab83b9ceb65c9672d3e7a35b8092e9bdc9b3ee80721471a161c10c59959c"}, "gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"}, @@ -59,7 +55,6 @@ "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, "json_xema": {:hex, :json_xema, "0.4.2", "85de190f597a98ce9da436b8a59c97ef561a6ab6017255df8b494babefd6fb10", [:mix], [{:conv_case, "~> 0.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:xema, "~> 0.11", [hex: :xema, repo: "hexpm", optional: false]}], "hexpm", "5516213758667d21669e0d63ea287238d277519527bac6c02140a5e34c1fda80"}, - "libgraph": {:hex, :libgraph, "0.13.3", "20732b7bafb933dcf7351c479e03076ebd14a85fd3202c67a1c197f4f7c2466b", [:mix], [], "hexpm", "78f2576eef615440b46f10060b1de1c86640441422832052686df53dc3c148c6"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_eex": {:hex, :makeup_eex, "0.1.1", "89352d5da318d97ae27bbcc87201f274504d2b71ede58ca366af6a5fbed9508d", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.16", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_html, "~> 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d111a0994eaaab09ef1a4b3b313ef806513bb4652152c26c0d7ca2be8402a964"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, @@ -68,7 +63,6 @@ "makeup_html": {:hex, :makeup_html, "0.1.0", "b0228fda985e311d8f0d25bed58f8280826633a38d7448cabdd723e116165bcf", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "0ca44e7dcb8d933e010740324470dd8ec947243b51304bd34b8165ef3281edc2"}, "makeup_js": {:hex, :makeup_js, "0.1.0", "ffa8ce9db95d14dcd09045334539d5992d540d63598c592d4805b7674bdd6675", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "3f0c1a5eb52c9737b1679c926574e83bb260ccdedf08b58ee96cca7c685dea75"}, "makeup_sql": {:hex, :makeup_sql, "0.1.0", "197a8a0a38e83885f73767530739bb8f990aecf7fd1597d3141608c14f5f233e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "556e23ff88ad2fb8c44e393467cfba0c4f980cbe90316deaf48a1362f58cd118"}, - "meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, @@ -109,9 +103,7 @@ "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, - "timex": {:hex, :timex, "3.7.9", "790cdfc4acfce434e442f98c02ea6d84d0239073bfd668968f82ac63e9a6788d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "64691582e5bb87130f721fc709acfb70f24405833998fabf35be968984860ce1"}, "typable": {:hex, :typable, "0.3.0", "0431e121d124cd26f312123e313d2689b9a5322b15add65d424c07779eaa3ca1", [:mix], [], "hexpm", "880a0797752da1a4c508ac48f94711e04c86156f498065a83d160eef945858f8"}, - "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, "ua_inspector": {:hex, :ua_inspector, "3.0.1", "649e68e31296a7bc39204e84b13a14c245b61df43fde0dd91ef784a98ecb04d4", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "b510ce5a5fd70a37bf5eab8008a25fc57388ea240b95bb4d98fc892648f9b916"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, "xema": {:hex, :xema, "0.17.0", "982e397ce0af55cdf1c6bf9c5ee6e20c5ea4a24e58e5266339cfff0dadbfa01e", [:mix], [{:conv_case, "~> 0.2.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9020afc75c5b9fba1c5875fd735a19c3c544db058cd97ef4c4675e479fc8bcbe"}, diff --git a/priv/repo/migrations/20221031143406_migrate_resources30.exs b/priv/repo/migrations/20221031143406_migrate_resources30.exs index c40d85a..f01611e 100644 --- a/priv/repo/migrations/20221031143406_migrate_resources30.exs +++ b/priv/repo/migrations/20221031143406_migrate_resources30.exs @@ -9,95 +9,95 @@ defmodule AshHq.Repo.Migrations.MigrateResources30 do def up do alter table(:options) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:modules) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:mix_tasks) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:library_versions) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:libraries) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:guides) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:functions) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:extensions) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end alter table(:dsls) do - add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()") - add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()") + add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")) + add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()")) end end def down do alter table(:dsls) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:extensions) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:functions) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:guides) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:libraries) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:library_versions) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:mix_tasks) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:modules) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end alter table(:options) do - remove :updated_at - remove :inserted_at + remove(:updated_at) + remove(:inserted_at) end end -end \ No newline at end of file +end diff --git a/priv/repo/migrations/20221103150903_migrate_resources32.exs b/priv/repo/migrations/20221103150903_migrate_resources32.exs index c296ada..203f9ab 100644 --- a/priv/repo/migrations/20221103150903_migrate_resources32.exs +++ b/priv/repo/migrations/20221103150903_migrate_resources32.exs @@ -9,13 +9,13 @@ defmodule AshHq.Repo.Migrations.MigrateResources32 do def up do alter table(:guides) do - add :default, :boolean, null: false, default: false + add(:default, :boolean, null: false, default: false) end end def down do alter table(:guides) do - remove :default + remove(:default) end end -end \ No newline at end of file +end diff --git a/test/ash_hq_web/controllers/user_session_controller_test.exs b/test/ash_hq_web/controllers/user_session_controller_test.exs index 28144b4..0d4d80a 100644 --- a/test/ash_hq_web/controllers/user_session_controller_test.exs +++ b/test/ash_hq_web/controllers/user_session_controller_test.exs @@ -42,16 +42,16 @@ defmodule AshHqWeb.UserSessionControllerTest do end end - describe "DELETE /users/log_out" do + describe "POST /users/log_out" do test "logs the user out", %{conn: conn, user: user} do - conn = conn |> log_in_user(user) |> delete(Routes.user_session_path(conn, :delete)) + conn = conn |> log_in_user(user) |> post(Routes.user_session_path(conn, :delete)) assert redirected_to(conn) == "/" refute get_session(conn, :user_token) assert get_flash(conn, :info) =~ "Logged out successfully" end test "succeeds even if the user is not logged in", %{conn: conn} do - conn = delete(conn, Routes.user_session_path(conn, :delete)) + conn = post(conn, Routes.user_session_path(conn, :delete)) assert redirected_to(conn) == "/" refute get_session(conn, :user_token) assert get_flash(conn, :info) =~ "Logged out successfully" diff --git a/test/ash_hq_web/controllers/user_settings_controller_test.exs b/test/ash_hq_web/controllers/user_settings_controller_test.exs index 769bb97..de52e2b 100644 --- a/test/ash_hq_web/controllers/user_settings_controller_test.exs +++ b/test/ash_hq_web/controllers/user_settings_controller_test.exs @@ -16,7 +16,8 @@ defmodule AshHqWeb.UserSettingsControllerTest do :deliver_update_email_instructions, %{ email: email, - current_password: valid_user_password() + current_password: valid_user_password(), + update_url_fun: &Routes.user_settings_url(AshHqWeb.Endpoint, :confirm_email, &1) }, authorize?: false ) diff --git a/test/live/settings_test.exs b/test/live/settings_test.exs index 58cfb6e..3cff18e 100644 --- a/test/live/settings_test.exs +++ b/test/live/settings_test.exs @@ -1,10 +1,8 @@ defmodule AshHq.SettingsTest do use AshHqWeb.ConnCase - import Plug.Conn import Phoenix.ConnTest import Phoenix.LiveViewTest - import Swoosh.TestAssertions @endpoint AshHqWeb.Endpoint @@ -58,7 +56,7 @@ defmodule AshHq.SettingsTest do assert_received {:email, email} - assert %{"url" => url} = Regex.named_captures(~r/(?http[^\s]*)/, email.text_body) + assert %{"url" => url} = Regex.named_captures(~r/(?http[^\s\"]*)/, email.html_body) path = URI.parse(url).path diff --git a/test/support/fixtures/accounts_fixtures.ex b/test/support/fixtures/accounts_fixtures.ex index 280c752..bc16cad 100644 --- a/test/support/fixtures/accounts_fixtures.ex +++ b/test/support/fixtures/accounts_fixtures.ex @@ -11,7 +11,9 @@ defmodule AshHq.AccountsFixtures do params = Enum.into(attrs, %{ email: unique_user_email(), - password: valid_user_password() + password: valid_user_password(), + confirmation_url_fun: + &AshHqWeb.Router.Helpers.user_confirmation_url(AshHqWeb.Endpoint, :confirm, &1) }) user =