草庐IT

have_selector

全部标签

ruby-on-rails - rspec should have_select ('cars' , :options => ['volvo' , 'saab' ] 不工作

关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion在首页我有:汽车:VolvoSaabMercedesAudistatic_pages_spec.rb中的测试代码:it"shouldhavetherightselect"dovisithome_pathit{shouldhave_select('cars',:options=>['volvo','saab','mercedes','audi'])}end响应是rspec./spec/request

ruby - 名称错误 : undefined - have parsing rules for local variables changed in Ruby 2. 1.2?

我得到NameError:undefinedlocalvariableormethodwithruby​​2.1.2正如在thisquestion中观察到的那样,表达式如:barifbar=true引发未定义的局部变量错误(前提是bar之前未定义),因为bar在分配之前被解析器读取。而且我相信以前用这个表达式没有什么区别:barifbar=false两者之间的区别在于主体是否被求值,但如果遇到未定义的局部变量会在求值条件之前立即引发错误,那应该无关紧要。但是当我在Ruby2.1.2上运行第二个代码时,它没有引发错误。以前也是这样吗?如果是这样,那么解析讨论的内容是什么?如果没有,Rub

ruby-on-rails - RefineryCMS 引擎错误 : did not have a valid gemspec

我无法安装任何引擎。从指南安装第一个事件引擎后,我收到一条错误消息,提示我没有有效的gem规范。Usingrefinerycms-events(1.0)fromsourceatvendor/extensionsrefinerycms-eventsat/Users/lydia/Desktop/projects/cmsex/vendor/extensions/eventsdidnothaveavalidgemspec.Thispreventsbundlerfrominstallingbinsornativeextensions,butthatmaynotaffectitsfunctiona

ruby /萨翁 : Having trouble with namespace for a soap request

我在更改正在构建的SOAPxml的命名空间时遇到问题。我不确定如何将“xmlns:env=”更改为“xmlns:soapenv=”,将“xmlns:tns=”更改为“xmlns:web=”我要构建的内容:100degreeCelsiusdegreeFahrenheit我目前得到的100degreeCelsiusdegreeFahrenheit我的代码:client=Savon.client(wsdl:"http://www.webservicex.net/ConvertTemperature.asmx?WSDL")message={temperature:'100',FromUnit:

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-on-rails - Rails 上的 ruby : How to have multiple submit buttons going to different methods (maybe with with_action? )

这个问题在这里已经有了答案:HowdoIcreatemultiplesubmitbuttonsforthesameforminRails?(7个答案)关闭9年前。所以..'save'%>'library'%>然后在我的Controller中:with_actiondo|a|a.savedoenda.librarydoendend问题是只有一个操作被调用...两个submit_tags调用相同的操作...知道为什么吗?或者我如何获得两个按钮以将表单提交给两种不同的方法?

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-on-rails - 停用 Gem - "you have already activated rake 0.9.3.beta.1, but my Gemfile requires rake 0.9.2"

我正在尝试运行迁移,但我不断收到错误消息:rakeaborted!Undefinedmethodprerequisitefornil:NilClass.似乎我以某种方式激活了一个名为rake0.9.3.beta.1的gem-但是我已经更改了gembundleinstall并运行bundleshowrake并且它显示安装了rake0.9.2。我是第一次使用Git,所以我认为这可能与仍在使用测试版rake的应用程序有关-但我已经完成了推送,它显示gemfile已更新。当我向下查看gem库时,我只能看到rake0.9.2版本。我应该看哪里?我还有一条Rails:Railtie弃用警告-但我认

ruby-on-rails - Phusion Passenger Error : You have activated rack 1. 2.1,但是你的 Gemfile 需要 rack 1.2.2

我正在尝试在Dreamhost共享服务器上运行RubyonRails应用程序。到目前为止一切都很好,除了一个我无法解决的奇怪错误。有时,当我访问网络应用程序时,会出现PhusionPassenger错误提示,Youhavealreadyactivatedrack1.2.1,butyourGemfilerequiresrack1.2.2.Considerusingbundleexec.当我只是刷新页面时,它似乎可以正常工作-不再显示PhusionPassenger错误消息。跟随其他堆栈溢出线程和类似的Dreamhostwiki,我将以下内容添加到config/environment.rb

ruby-on-rails - rake 数据库 :reset 'user does not have CONNECT privilege'

所以我在我的Rails应用程序中使用HerokuPostgres,但我没有在Heroku本身上托管我的应用程序。我在我的database.yml中使用了来自Heroku的ActiveRecord连接详细信息,它看起来像这样:development:adapter:postgresqlencoding:unicodepool:5database:[database]username:[username]password:[password]host:ec2-54-227-243-78.compute-1.amazonaws.comport:5432但是,现在我正在尝试rakedb:mig