草庐IT

extension_test_contest

全部标签

ruby-on-rails - rails : "missing partial" when calling 'render' in RSpec test

我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou

ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension

我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

ruby-on-rails - gem install rmagick -v 2.13.1 错误 Failed to build gem native extension on Mac OS 10.9.1

我已经通过提供MagickWand.h的路径尝试了一切,我安装了命令工具。谁能帮帮我?$geminstallrmagick-v2.13.1Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingrmagick:ERROR:Failedtobuildgemnativeextension./Users/ghazanfarali/.rvm/rubies/ruby-1.8.7-p357/bin/rubyextconf.rbcheckingforRubyversion>=1.8.5...yescheckingfor/

ruby 单元测试 : run some code after each failed test

在Test::Unit中的ruby​​单元测试断言失败后,在执行teardown之前,是否有一些简洁优雅的方法来立即执行我的代码?我正在做一些自动化的GUI测试,并希望在出现问题后立即截图。 最佳答案 如果您使用的是1.9,请不要使用Test::Unit::TestCase作为您的基类。对其进行子类化并覆盖#run_test以进行救援,截取屏幕截图并重新提出:classMyAbstractTestCase或者,我认为这实际上是最简洁的方法,您可以使用before_teardownHook:classMyTestCase这不适用于1.

ruby-on-rails - 如何扩展 Ruby Test::Unit 断言以包含 assert_false?

显然在Test::Unit中没有assert_false。您将如何通过扩展断言并添加文件config/initializers/assertions_helper.rb来添加它?这是最好的方法吗?我不想修改test/unit/assertions.rb。顺便说一句,我不认为这是多余的。我使用的是assert_equalfalse,something_to_evaluate。这种方法的问题是很容易意外使用assertfalse,something_to_evaluate。这将始终失败,不会引发错误或警告,并且会在测试中引入错误。 最佳答案

ruby-on-rails - 安装 fcgi : Failed to build gem native extension 时出现 Rails 错误

我正在运行命令bundleinstall在我的Rails项目中,它给出了错误:...Usingactiverecord(3.0.11)Usingactiveresource(3.0.11)Usingbigdecimal(1.1.0)Installingfcgi(0.8.8)withnativeextensionsGem::Installer::ExtensionBuildError:ERROR:Failedtobuildgemnativeextension./home/jjboat/.rvm/rubies/ruby-1.9.3-p194/bin/rubyextconf.rbchecki

ruby - 错误 : Failed to build gem native extension on Windows

我在安装“redcarpet”gem时遇到以下错误。它在我friend的机器上安装没有问题。(我想安装它来运行yard)ruby版本:1.9.3命令输出:D:\Learning\Common_POM_FW\SampleProjects>yard[error]:Missing'redcarpet'gemforMarkdownformatting.Installitwith`geminstallredcarpet`D:\Learning\Common_POM_FW\SampleProjects>geminstallredcarpetTemporarilyenhancingPATHtoinc

ruby-on-rails - 脚本/服务器 custom_require.rb :36:in `require' : cannot load such file -- test/unit/error (LoadError)

我有一个基于1.8.7构建的应用程序,我正尝试在1.9.3的系统上启动它当我运行脚本/服务器时,我得到:/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require':cannotloadsuchfile--test/unit/error(LoadError)from/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require'我的服务器脚本如下所示:#!/usr/bin/envrubyrequireFile.expand_path('../.

ruby-on-rails - rspec rails 测试 : how can I force ActiveJob job's to run inline for certain tests?

我希望我的后台作业能够内联运行某些标记测试。我可以通过用perform_enqueueddo包装测试来做到这一点,但我希望能够用元数据标记它们,如果可能的话,它会自动发生。我试过以下方法:it"doeseverythinginthejobtoo",perform_enqueued:truedoendconfig.around(:each)do|example|ifexample.metadata[:perform_enqueued]perform_enqueued_jobsdoexample.runendendend但它会导致错误:undefinedmethod`perform_enq

ruby-on-rails - Rails 5 升级 :/actionpack-5. 0.0/lib/action_controller/test_case.rb:49:in `initialize':参数数量错误(0 代表 2)(ArgumentError)

我最近正在进行Rails5升级,当我尝试启动Rails控制台时遇到了这个错误:/actionpack-5.0.0/lib/action_controller/test_case.rb:49:ininitialize':wrongnumberofarguments(0for2)(ArgumentError)当前bundleupdaterails已经完成了gem依赖项的解决,足以更新到5.0.0,rspec正在运行(尽管我正在修复很多中断)。我也可以运行railss没有错误。这里是代码中断行:https://github.com/rails/rails/blob/master/action