mardi 1 octobre 2019

Database error on executing test Ruby on Rails with postgre

I have been in trouble with this error caused when I started to code my tests on ruby on rails. (I'm just a beginner using this framework).

I really get stuck. I have search in the web but the posts that I have found did not help me. I leave the references:

Rails: Relation does not exist for reference with class name in production

https://github.com/rails/rails/issues/29206

PG undefinedtable error relation users does not exist

This is the test that I made: App/test/models/material_test.rb

require 'test_helper'

class MaterialTest < ActiveSupport::TestCase
  test "the truth" do
   assert true
  end
end

When I try to execute it using:

rails test

I got the following error:

# Running:

E

Error:
CategoriesControllerTest#test_the_truth:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "object_formats" does not exist
LINE 8:                WHERE a.attrelid = '"object_formats"'::regcla...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"object_formats"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum


My repo is public and the code is up to date.

https://github.com/FragmentX/FRAGMENTX




Aucun commentaire:

Enregistrer un commentaire