小编ror*_*ris的帖子

Rails:旧的,不存在的数据库表导致测试错误

我一直试图在我最近负责的Rails应用程序中运行一个"真实"单元测试,mac_test.rb.它看起来像这样:

    require 'test_helper'

    class MacTest < ActiveSupport::TestCase
      # Replace this with your real tests.
      test "the truth" do
        assert true
      end
    end
Run Code Online (Sandbox Code Playgroud)

我跑了rake db:test:prepare,我正试图运行测试ruby -I test test/unit/mac_test.rb.

但是,我得到以下缩写错误输出:

    Loaded suite test/unit/mac_test
    Started
    EEEEEEEEEEEEEEE
    Finished in 0.377261 seconds.

      1) Error:
    test_datas(ActionController::IntegrationTest):
    ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: vendors: DELETE FROM "vendors" WHERE 1=1


      2) Error:
    testjigs(ActionController::IntegrationTest):
    ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: vendors: DELETE FROM "vendors" WHERE 1=1


      3) Error:
    test_datas(ActionController::TestCase):
    ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: vendors: DELETE FROM …
Run Code Online (Sandbox Code Playgroud)

unit-testing ruby-on-rails

11
推荐指数
1
解决办法
2605
查看次数

标签 统计

ruby-on-rails ×1

unit-testing ×1