Thanks, Phil. As it happens I am using `ActiveRecord::Base.connection.schema_cache.clear!` although I didn't add it to the example as it appears not to be necessary for Rails 6.1+. It resets the database connection, so a table that is dropped and recreated with different columns is used correctly, but it doesn't do anything about the model as configured in Ruby.
As I said in my reply to Jon, I think I am going to have to go down the route of setting up all the models and database tables in one place rather than having them configured in the setup of each test. Regards, Joe On Tuesday, 27 July 2021 at 21:01:57 UTC+1 pirj...@gmail.com wrote: > Hi Joe, > > I would suspect that this isn't due to RSpec caching something, but > more likely due to Rails caching relations internally. > Would `ActiveRecord::Base.connection.schema_cache.clear!` in your root > `before` help? > > - Phil > -- 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/f71a0eaa-7aed-481b-9465-4a1acd830992n%40googlegroups.com.