Background
Hey, I'm attempting to get a broken testing suite for my Rails 4 application working.
I had a table called task_comments back somewhere in the history of the application and there were some changes that called for the table to be deleted. Which it is, just fine.
Rails: 4.2.11.3
Ruby: 2.3
Postgres: 15.2 (Debian 15.2-1.pgdg110+1)
The Problem
The problem seems to be something with how ActiveRecord works with Postgres when wiping the testing database and it's thinking task_comments is supposed to still be in the application.
The problem comes when I try to run a test file that looks like this:
require 'test_helper'
class ClientTest < ActiveSupport::TestCase
test "the truth" do
puts "asserting via test case"
assert true
end
end
I'm getting this issue:
$ rake test test/unit/client_test.rb
/usr/local/bundle/gems/mailman-rails-0.0.3/lib/mailman-rails/tasks/mailman.rake
Run options: --seed 29404
1) Error:
ClientTest#test_the_truth:
RuntimeError: Wrapped undumpable exception for: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "task_comments" does not exist
LINE 1: DELETE FROM "task_comments"
Work Done
What I've tried to correct the issue:
RAILS_ENV=test rake db:drop; # Removing the entire database
RAILS_ENV=test rake db:create; # Initializing the database
RAILS_ENV=test rake db:schema:load; # Reloading the db:schema
RAILS_ENV=test rake db:migrate # Repoplulating database structure
Also note that when reloading the schema, the table task_comments is not loaded in, and it is NOT in schema.rb, so I'm kind of stuck here in running a testing suite.
Similar issue that doesn't solve the problem: PG::UndefinedTable: ERROR: table "table-name" does not exist