I am trying to create a Rails engine using RSpec for testing and I am following guides like this:
https://www.codementor.io/@mohnishjadwani/how-to-setup-rspec-factory-bot-and-spring-for-a-rails-5-engine-qjdpthfb1 I have followed the guide up to the point where RSpec is set up but not Factory Bot (i.e., stopping after "Step 5: Get RSpec to load the Rails environment of the dummy app") and everything is working OK. I have put this in a Github repository here: https://github.com/jrmhaig/sample_engine However, when I try to create a second model I am consistently getting "pending migration" errors from RSpec: ``` sample_engine$ bundle exec rails db:drop db:create db:migrate RAILS_ENV=test Dropped database 'db/test.sqlite3' Created database 'db/test.sqlite3' == 20210215210420 CreateSampleEngineWidgets: migrating ======================== -- create_table(:sample_engine_widgets) -> 0.0013s == 20210215210420 CreateSampleEngineWidgets: migrated (0.0014s) =============== == 20210215210756 CreateSampleEngineGrommets: migrating ======================= -- create_table(:sample_engine_grommets) -> 0.0013s == 20210215210756 CreateSampleEngineGrommets: migrated (0.0013s) ============== sample_engine$ bundle exec rspec Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=test You have 1 pending migration: 20210215210420_create_sample_engine_widgets.rb No examples found. ``` I have put the changes to see this in a branch here: https://github.com/jrmhaig/sample_engine/tree/second_model I can switch back to the master branch, where there is only one model, and the `bundle exec rails db:drop db:create db:migrate RAILS_ENV=test; bundle exec rspec` works again as expected. I'm sure there is something very simple I am missing but this has been driving me up the wall for the past day, and every single guide I have found online stops after creating a single model. Can anyone help? Regards, Joe -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/40cc291a-a7bc-456b-9299-21a156592a4an%40googlegroups.com.