* Skip Spring version 2.1.1
Changes introduced in spring 2.1.1
(https://github.com/rails/spring/pull/621) are breaking some tests. That
change was reverted in https://github.com/rails/spring/pull/629, but
hasn't been released yet. Until #629 is released, this PR skips Spring
version 2.1.1.
* Bump to latest standard to match CI
We are using the latest standard on CI. This bumps the version in the
dev Gemfile to match, and fixes one violation.
Co-authored-by: Daniel J. Colson <daniel.colson@hey.com>
Previously our tests were not covering the line where we [add the
factory_bot_rails reloader to the list of Rails reloaders][reloaders
push]. [Spring checks this reloaders list][spring] to decide whether it
needs to reload the rails application. Without adding our reloader to
this list changes to factory_bot definitions would only get picked up
by running `spring stop` (or disabling spring entirely).
This test will ensure we don't accidentally break this interaction
between factory_bot_rails and spring.
While adding this test this commit pulls out a bit of shared background for
the tests in this file, and also removes some Rails 4.2 logic that isn't
necessary anymore since we won't support Rails 4.2 for factory_bot_rails
6.
[reloaders push]: https://github.com/thoughtbot/factory_bot_rails/blob/master/lib/factory_bot_rails/reloader.rb#L42
[spring]: 647b8c3135/lib/spring/application.rb (L165)
This commit gets the Travis build passing by:
- Removing Rails 4.2 so we don't have to deal with bundler < 2 anymore
- Bumping to latest Rails versions
- Explicitly listing all gems that appear in the default Rails Gemfile
- Avoiding bootsnap and javascript, since they aren't relevant to these tests
Co-authored-by: alex <alexandr1golubenko@gmail.com>
* Write a failing test for reloading with Spring
This test captures what I think is going on in
https://github.com/thoughtbot/factory_bot_rails/issues/323
Currently the factory_bot_rails reloader only reloads factory
definitions when the definition files have changes (using
`execute_if_updated`).
This can cause problems when editing an application file without also
editing a factory_bot definition file. Rails will reload the entire
application, but will not reload the definitions. This causes
factory_bot to have references to classes that were unloaded from the
Rails application and replaced with new classes.
https://github.com/thoughtbot/factory_bot_rails/pull/329 replaces
`execute_if_updated` with `execute` so that factory_bot_rails will
reload the definition files whenever anything in the application is
changed. Hopefully that PR will get this test to pass!