elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
826 stars 139 forks source link

Resolves deprecation warnings, fixes failing test case #182

Closed darrenklein closed 2 years ago

darrenklein commented 2 years ago

Thank you so much for all of your hard work on this repo! I hope this is a helpful PR...

This PR resolves the following deprecation warnings that were emitted when running mix test:

warning: Money.Ecto.Type.cast/1 is deprecated. Use Money.Ecto.Amount.Type.cast/1 instead
Invalid call found at 13 locations:
  test/money/ecto_type_test.exs:20: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:21: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:22: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:23: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:24: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:25: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:26: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:27: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:28: Money.Ecto.TypeTest."test cast/1 String"/1
  test/money/ecto_type_test.exs:32: Money.Ecto.TypeTest."test cast/1 integer"/1
  test/money/ecto_type_test.exs:36: Money.Ecto.TypeTest."test cast/1 Money"/1
  test/money/ecto_type_test.exs:40: Money.Ecto.TypeTest."test cast/1 Map"/1
  test/money/ecto_type_test.exs:47: Money.Ecto.TypeTest."test cast/1 other"/1

warning: Money.Ecto.Type.dump/1 is deprecated. Use Money.Ecto.Amount.Type.dump/1 instead
Invalid call found at 3 locations:
  test/money/ecto_type_test.exs:55: Money.Ecto.TypeTest."test dump/1 integer"/1
  test/money/ecto_type_test.exs:59: Money.Ecto.TypeTest."test dump/1 Money"/1
  test/money/ecto_type_test.exs:63: Money.Ecto.TypeTest."test dump/1 other"/1

warning: Money.Ecto.Type.load/1 is deprecated. Use Money.Ecto.Amount.Type.load/1 instead
  test/money/ecto_type_test.exs:51: Money.Ecto.TypeTest."test load/1 integer"/1

warning: Money.Ecto.Type.type/0 is deprecated. Use Money.Ecto.Amount.Type.type/0 instead
  test/money/ecto_type_test.exs:16: Money.Ecto.TypeTest."test type/0"/1

It also resolves a failing test case that became evident as a result of fixing those warnings.

Nitrino commented 2 years ago

Hi @darrenklein Do you have these warnings in your project? They should only appear if you are using a deprecated module. We cannot just remove this module from the library yet, as this would require a major version change due to loss of backwards compatibility.

Thanks for your contribution and interest in the library, pull requests are always welcome.

darrenklein commented 2 years ago

Ah that was really presumptuous of me, closing this PR - thank you for your consideration nonetheless!