I'm getting this strange error when I try to run my test in rails:
postgresql_adapter.rb:592:in `async_exec': PG::UndefinedTable: ERROR: relation "users" does not exist (ActiveRecord::StatementInvalid)
I don't know if this helps but my spec_helper.rb
file looks like this:
require 'rubygems'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'factory_girl_rails'
require 'database_cleaner'
require 'capybara/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
require 'support/mailer_macros'
require 'support/test_helper'
require 'support/factory_girl_helper'
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new app, window_size: [1600, 1200], js_errors: false
end
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.include(FactoryGirlHelper)
config.include(MailerMacros)
config.include(TestHelper)
config.before(:each) { reset_email }
config.expect_with :rspec do |c|
c.syntax = [:should, :expect]
end
Capybara.javascript_driver = :poltergeist
config.include Capybara::DSL
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation) # moving to before :each doesn't help
DatabaseCleaner.strategy = :truncation # moving to before :each doesn't help
end
config.around :each do |example| # refactoring as before/after with .start/.clean doesn't help
DatabaseCleaner.cleaning { example.run }
end
end
Anyone has any idea why this is happening? The application in the browser seems to be working fine.