-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable_referential_integrity does not work with PostGIS tables #19
Comments
Similar issue here, just that rspec is completely hanging so I needed to do this trick and found Here's the complete RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation, { except: %w[spatial_ref_sys] })
end
config.prepend_before(:each) do
DatabaseCleaner.start
end
config.append_after(:each) do
DatabaseCleaner.clean
end
end UPDATE: Here's the entire output:
|
Maybe this isn't an issue with database_clenaer after all, couldn't this be an issue with the pg gem itself? See https://bitbucket.org/ged/ruby-pg/issues/75/hang-in-pgconn-block-while-waiting-for. |
I believe this is a problem with ActiveRecord as mentioned here. I've fixed this for my problems by adding the following monkey patch in test_helper.rb. I also use :truncation and no transactional fixtures
Initially, my tests took 30 mins to run, but by adding the :pre_count option it dropped back to a more reasonable 7 mins. |
We use the PostGIS extension and the rgeo AR gem. We use truncation for our
js
tests as well as ourbefore(:suite)
strategy.The problem is that the PostGIS extension creates a table
spatial_ref_sys
that is owned by the user who installs the extension (namely, a super user).Running
bundle exec rspec
fails with the following error:The error comes from the call to
disable_referential_integrity
because it calls all tables, ignoring any tables that might have beenexclude
d via thetruncation
options.Our
database_cleaner.rb
file:One workaround is to execute the tests as a db super user. Another would be to change the ownership of the
spatial_ref_system
table. Neither of these are very desirable.Is there a way to skip tables in the
disable_referential_integrity
call?The text was updated successfully, but these errors were encountered: