草庐IT

custom-selectors

全部标签

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 - rails 5 : Autoloading with custom folders not working

我有这门课:#app/events/new_request.rbclassEvents::NewRequestend然后我将该文件夹添加到自动加载:#config/application.rbconfig.autoload_paths+=%W(events/)当运行railsc时:>Events::NewRequestNameError:uninitializedconstantEvents问题是,如果我在定义类时不使用命名空间“Events”,它会成功自动加载类。 最佳答案 moduleSandboxclassApplicatio

ruby-on-rails - Rails 4.2 Action Controller :BadRequest custom error message

如果验证失败或参数丢失,我想从我的Controller返回400-错误请求。所以在我的Controller中如果有ifparams["patch"].nil?thenraiseActionController::BadRequest.new("TheJsonbodyneedstobewrappedinsidea\"Patch\"key")end我在我的应用程序Controller中发现了这个错误:rescue_fromActionController::BadRequest,with::bad_requestdefbad_request(exception)renderstatus:4

ruby-on-rails - rails : Loading custom class from lib folder in controller

我创建了一个名为lib/services/my_service.rb的文件。#/lib/services/my_service.rbclassMyService...end我想在app/controllers/my_controller中使用它classMyController我收到一个错误消息,指出MyService是一个未初始化的常量。我尝试用导入它require'/lib/services/my_service.rb'但是我得到了cannotloadsuchfile--/lib/services/my_service.rb编辑:我尝试使用application.rb自动加载con

ruby - Capybara 的 have_selector 有哪些选项?

我在RSpec中遇到了这个错误。have_selector是否有任何文档解释选项哈希中的每个键及其具体作用?invalidkeys:content,shouldbeoneof:text,:visible,:between,:count,:maximum,:minimum,:exact,:match,:wait 最佳答案 capybara为rspec提供了这个方法。capybara'sdocs不要轻易找到问题的答案,所以让我们按照来源:have_selector在Capybara::RSpecMatchers中。它委托(delegat

ruby - Firebase token 错误, "The custom token corresponds to a different audience."

我正在尝试在服务器上使用Ruby为Firebase生成JWTtoken。在3.0之前我们使用tokengenerator但升级后它停止工作。我用下面的代码得到的token给出了一个错误:Thecustomtokencorrespondstoadifferentaudience.我到处都找不到它的意思。private_key=OpenSSL::PKey::RSA.new谢谢 最佳答案 我也遇到了这个错误,我得到它是因为我使用了一个与firebase项目无关的服务帐户。在firebase项目下使用新key创建新服务帐户后,它开始工作。要

ruby-on-rails - rails : link_to calls custom method in controller

我希望使用link_to来调用我的Controller中的方法。但是,由于某些奇怪的原因,路由会寻找show方法。在我看来:..beverage.id)%>..在我的config/routes.rb中match'beverages/archive'=>'beverages#archive'在我的beverages_controller.rb中defarchivebeverage=Beverage.find(params[:id])respond_todo|format|#format.html#show.html.erbformat.json{renderjson:beverage}e

ruby - 卡皮斯特拉诺 3 : use server custom variable in task

我有多阶段多服务器设置,在我的任务中我需要使用服务器名称例如在stagin.rb我有:set:stage,:staging#Defineserversserver'xxx.xx.xx.xxx',user:'deploy',roles:%w{app},name:'app1'server'xxx.xx.xx.yyy',user:'deploy',roles:%w{app},name:'app2'我想在我的任务中使用那个“名称”变量:task:configuredoonroles(:app),in::paralleldo#howdoIgetservernamehere?endend

ruby-on-rails - capybara 和 Rspec : correct way to use within() and have_selector() together?

我使用rspec2.6.0和Capybara1.1.1进行验收测试。具有如下View:Team3NametrueShowEditDeactivateTeam4NametrueShowEditDeactivate我想编写一个验收测试,声明:“团队3没有‘停用’链接。”我希望以下操作失败:within('tr',:text=>'Team3Name')do|ref|page.should_nothave_selector('a',:text=>'Deactivate')end但它过去了。为了进一步测试发生了什么,我写了荒谬的:lock=falsewithin('tr',:text=>'Tea

ruby - custom_require.rb :36:in `require' : no such file to load -- myapp(LoadError)

我收到上述错误,我所做的只是安装rvm并从您使用mac获得的默认ruby​​更新到ruby​​1.9.2。我所有的gem都出现在gem列表中,但我需要在某处指定路径吗?干杯,格伦诺。 最佳答案 检查你是否安装了gemsgemlist如果没有,照常安装geminstallwhatever或者如果你想要特定版本geminstallwhatever-v1.2.3或者如果你的项目中有bundler(即Rails),它只是bundleinstall如果您拥有所有的gem,那么这可能是一个本地文件,并且您可能来自Ruby版本$LOAD_PATH