Why:
These are essentially internal methods that should not be publicly
available from the base namespace.
One thing worth noticing is that the use of this methods internally was
almost exclusively in the `syntax/default` except for one use on the
`factory_bot/definition`.
Also the deprecation silencing module was referring to the singleton
instance of the ```ActiveRecord::Deprecation``` class and not to the new
deprecation instance that was being used in the ```FactoryBot``` module.
This PR:
- Moves the `trait_by_name` and `register_trait` into the
`FactoryBot::Internal` module
- Deprecates uses of `trait_by_name`, `register_trait` and `traits` from
the `FactoryBot` module.
- Rename DEPRECATOR => Deprecation
This is one of the steps towards fixing [this
issue](https://github.com/thoughtbot/factory_bot/issues/1281)
Fixes#1257
When sequence rewinding was first introduced in #1078 it only applied to
globally defined sequences. To get rewinding to work for inline
sequences as well we registered them "privately" in the global registry
in #1164. Unfortunately in #1164 we did not take inline sequences inside
traits into consideration. Since trait names are not unique, it is
possibly to get a `FactoryBot::DuplicateDefinitionError` when defining
two sequences that have the same name in two traits that have the same
name.
This PR abandons the idea of "privately" registering inline sequences,
and instead keeps a separate list of all the inline sequences just for
the purpose of rewinding them.
The `FactoryBot` module has a mixture of methods that are meant for use
by people using the library, and methods that are meant only for
internal use. The methods meant for internal use are cluttering the
documentation, and may be confusing to users.
This change was prompted by [#1258]. Rather than introduce yet another
public method on `FactoryBot` meant only for internal use,
we can introduce a `FactoryBot::Internal` module,
and avoid generating documentation for that module.
The `FactoryBot::Internal.register_inline_sequence` method in [#1258]
will need access to the configuration instance, so this PR moves that
into `FactoryBot::Internal`. Eventually I plan to deprecate
`FactoryBot.configuration` and `FactoryBot.reset_configuration`, and to
move more of the `FactoryBot` methods into `FactoryBot::Internal`, but I
would rather hold off on all that until the dust settles on the 5.0
release.
[#1258]: https://github.com/thoughtbot/factory_bot/pull/1258