Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Elixir 1.18 #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,34 @@ jobs:
matrix:
# https://hexdocs.pm/elixir/compatibility-and-deprecations.html
include:
- elixir-version: 1.17.x
otp-version: 27.x
- elixir-version: 1.17.x
otp-version: 26.x
- elixir-version: 1.17.x
otp-version: 25.x
- elixir-version: 1.16.x
otp-version: 26.x
- elixir-version: 1.16.x
otp-version: 25.x
- elixir-version: 1.15.x
otp-version: 26.x
- elixir-version: 1.15.x
otp-version: 25.x
- elixir-version: 1.14.x
otp-version: 25.x
- elixir-version: 1.13.x
otp-version: 24.x
- elixir-version: "1.18"
otp-version: "27"
- elixir-version: "1.18"
otp-version: "26"
- elixir-version: "1.18"
otp-version: "25"
- elixir-version: "1.17"
otp-version: "27"
- elixir-version: "1.17"
otp-version: "26"
- elixir-version: "1.17"
otp-version: "25"
- elixir-version: "1.16"
otp-version: "26"
- elixir-version: "1.16"
otp-version: "25"
- elixir-version: "1.15"
otp-version: "26"
- elixir-version: "1.15"
otp-version: "25"
- elixir-version: "1.14"
otp-version: "25"
- elixir-version: "1.13"
otp-version: "24"
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp-version }}
Expand Down
31 changes: 1 addition & 30 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

config :absinthe_error_payload,
ecto_repos: [],
field_constructor: AbsintheErrorPayload.FieldConstructor

# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# 3rd-party users, it should be done in your "mix.exs" file.

# You can configure for your application as:
#
# config :absinthe_error_payload, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:absinthe_error_payload, :key)
#
# Or configure a 3rd-party app:
#
# config :logger, level: :info
#

# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
5 changes: 5 additions & 0 deletions test/changeset_parser_custom_field_constructor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ defmodule AbsintheErrorPayload.ChangesetParserCustomFieldConstructorTest do
end

setup do
original_field_constructor = Application.get_env(:absinthe_error_payload, :field_constructor)
Application.put_env(:absinthe_error_payload, :field_constructor, CustomFieldConstructor)

on_exit(fn ->
Application.put_env(:absinthe_error_payload, :field_constructor, original_field_constructor)
end)
Comment on lines +65 to +70
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running ExUnit with seed: 554479, max_cases: 16

..........................

  1) test multiples multiple fields with errors (AbsintheErrorPayload.ChangesetParserTest)
     test/changeset_parser_test.exs:88
     match (=) failed
     code:  assert %ValidationMessage{field: "author.name", key: :name} = first
     left:  %AbsintheErrorPayload.ValidationMessage{field: "author.name", key: :name}
     right: %AbsintheErrorPayload.ValidationMessage{
              field: "author›name",
              key: :name,
              code: :required,
              options: [],
              template: "can't be blank",
              message: "can't be blank"
            }
     stacktrace:
       test/changeset_parser_test.exs:104: (test)

..

  2) test nested nested fields with errors on replaced embeds_many (AbsintheErrorPayload.ChangesetParserTest)
     test/changeset_parser_test.exs:154
     match (=) failed
     code:  assert %ValidationMessage{
              message: "can't be blank",
              code: :required,
              field: "embedded_tags.0.name",
              key: :name
            } = first
     left:  %AbsintheErrorPayload.ValidationMessage{
              message: "can't be blank",
              code: :required,
              field: "embedded_tags.0.name",
              key: :name
            }
     right: %AbsintheErrorPayload.ValidationMessage{
              field: "embedded_tags@0›name",
              key: :name,
              code: :required,
              options: [],
              template: "can't be blank",
              message: "can't be blank"
            }
     stacktrace:
       test/changeset_parser_test.exs:168: (test)

...

  3) test nested nested has many fields with errors (AbsintheErrorPayload.ChangesetParserTest)
     test/changeset_parser_test.exs:172
     match (=) failed
     code:  assert %ValidationMessage{code: :required, field: "tags.0.name", key: :name} = first
     left:  %AbsintheErrorPayload.ValidationMessage{code: :required, field: "tags.0.name", key: :name}
     right: %AbsintheErrorPayload.ValidationMessage{
              field: "tags@0›name",
              key: :name,
              code: :required,
              options: [],
              template: "can't be blank",
              message: "can't be blank"
            }
     stacktrace:
       test/changeset_parser_test.exs:186: (test)

....

  4) test nested nested fields with errors (AbsintheErrorPayload.ChangesetParserTest)
     test/changeset_parser_test.exs:137
     match (=) failed
     code:  assert %ValidationMessage{code: :required, field: "author.name", key: :name} = first
     left:  %AbsintheErrorPayload.ValidationMessage{code: :required, field: "author.name", key: :name}
     right: %AbsintheErrorPayload.ValidationMessage{
              field: "author›name",
              key: :name,
              code: :required,
              options: [],
              template: "can't be blank",
              message: "can't be blank"
            }
     stacktrace:
       test/changeset_parser_test.exs:151: (test)

..

  5) test construct_message/2 creates expected struct (AbsintheErrorPayload.ChangesetParserTest)
     test/changeset_parser_test.exs:192
     Assertion with == failed
     code:  assert message.field == :title
     left:  "@root›title"
     right: :title
     stacktrace:
       test/changeset_parser_test.exs:201: (test)

........
Finished in 0.6 seconds (0.00s async, 0.6s sync)
1 doctest, 49 tests, 5 failures

end

describe "construct_message/2" do
Expand Down
Loading