当前位置: 首页 > 知识库问答 >
问题:

从Rails3.2升级到Rails4.2之前的测试套件

罗伟志
2023-03-14

我最近尝试将我的Rails应用程序从Rails3.2更新到Rails4.2。在升级之前,我所有的测试套件都运行得很好,但是在更新之后,我得到了一些奇怪的东西。每次尝试运行测试时,都会发生相同的错误

rake db:fixtures:load --trace
** Invoke db:fixtures:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:fixtures:load
rake aborted!
NameError: uninitialized constant ActiveRecord::FixtureSet::RenderContext::MassiveMessage
(erb):11:in `get_binding'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `eval'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `result'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:42:in `render'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:33:in `rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:24:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:758:in `block (2 levels) in read_fixture_files'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:15:in `open'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:757:in `block in read_fixture_files'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each_with_object'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `read_fixture_files'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:592:in `initialize'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `new'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `block (2 levels) in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `map'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `block in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in '
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/home/alexander/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `'

rake aborted!
TypeError: no implicit conversion of Fixnum into String
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `gsub'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `block (2 levels) in table_rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `block in table_rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `map'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `table_rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:523:in `block in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in '
Tasks: TOP => db:fixtures:load
(See full trace by running task with --trace)

共有1个答案

孔扬
2023-03-14

我在github的rails存储库中发布了这个问题,他们回答说这是一个bug,将在4.2.1版本发布

目前,你可以纠正这一点,这样做。row[key]=value.gsub(“$label”,label.to_s)如果value.is_a?(String)位于activerecord库文件fixture.rb的第636行

 类似资料:
  • 测试使用Jetty服务器周围的包装器作为连接到的主机。对于主机和客户端来说,truststore和keystore是相同的。出于某种原因,从2.5到2.6的更改导致服务器提前关闭。 我唯一要改变的是maven中的OkHttp版本从2.5到2.6。测试类在这里(实现在TestInvokeHttpCommon中):https://github.com/apache/nifi/blob/8c2323dc

  • 当我将pom.xml(Maven)中的现有包从QAF 3.0.0升级到3.0.1b时,自动化测试停止了TestNG中提到的测试。 结果:测试运行:0,失败:0,错误:0,跳过:0[信息]生成成功 /config/ /src/... ...等

  • 我正在从四年级升到六年级。这迫使我升级了很多东西,比如spring、h2、mySql连接器等。。 现在我有这个问题:在运行时,使用MySQL都很好。但是在测试中,我得到: 这是一个在升级之前运行良好的旧脚本。 版本: Spring靴:2.3.0 组织。flywaydb:flyway core:6.4.1(尽管在gradle我放了6.4.2) com。h2数据库:h2:1.4.200 mysql:m

  • 为了帮助大伙儿升级,我们为现在的Apache用户提供了一份重要信息的文档说明。这些只是一些简要说明,你可以从新特性文档或src/CHANGES文件中得到更多信息。 这篇文档仅仅描述了从版本 2.0 到 2.2 的变化,如果你是从1.3版进行升级的,请查考从1.3升级到2.0文档。 编译时配置的改变 编译过程与2.0版本非常相似,你曾经使用过的configure命令行(在安装目录下的build/co

  • 为了帮助大伙儿升级,我们为现在的Apache用户提供了一份重要信息的文档说明。这些只是一些简要说明,你可以从新特性文档或src/CHANGES文件中得到更多信息。 编译时配置的改变 Apache现在使用autoconf和libtool系统来进行安装进程的配置。这个系统用起来很像Apache1.3的APACI系统,但并不相同。 在普通的选择编译模块的基础上,Apache2.0把请求进程的主要部分移到

  • WARNING 本升级指南仅适用于 2.2 版本升级至 2.3 版本,如果你并非 2.2 版本,请查看其他升级指南,Plus 程序不允许跨版本升级! 更新代码 预计耗时: 2 小时 这是你自我操作的步骤,确认将你的 2.2 版本代码升级到 2.3 版本,如果你做过一些自定义修改可能会出现代码冲突,你需要解决。 升级依赖 预计耗时: 3 分钟 进入 Plus 程序目录,执行: composer up