0

On Rails - 5.0.3 and Ruby - 2.3.3, when I run rails test, it keeps asking me to run migrations. It does not maintain migrations state.

Tried following -

Adding ActiveRecord::Migration.maintain_test_schema! in test_helper.rb as mentioned here.

Can someone please help? Its really annoying and slow to run migrations everytime I run test.

enter image description here

UPDATE After debugging a lot. Figured that rails/test_help is creating the issue. If I comment it out, it works fine. Why is it that creating issue?

enter image description here

Disha
  • 776
  • 9
  • 19
  • Does your `schema_migrations` tables has any records? – Tai Feb 12 '18 at 07:29
  • @Tai It inserts when I run migrations but after few minutes the whole DB becomes empty. I have no idea why this happens. – Disha Feb 12 '18 at 08:30
  • Do you use `database_cleaner` to clean up database after test? If so, can you pass your config? – Tai Feb 12 '18 at 08:36
  • No. Not using `database_cleaner` – Disha Feb 12 '18 at 08:48
  • How do you cleanup database after run test? – Tai Feb 12 '18 at 09:19
  • I just started working on a legacy code which din't have any tests. Only test_helper config file. No config for database cleanup but still cleans everytime. Hence confused – Disha Feb 12 '18 at 09:21

0 Answers0