jjzjj

node.js-stream

全部标签

Ruby:Phantom.js 在特定站点上被阻止?

我正在使用capybarapoltergeist来自动化tumblr.com上的一个小脚本我的脚本在我的chrome驱动程序上运行良好。我的poltergeist驱动程序加载所有其他网站都很好,但由于某种原因,当我尝试加载tumblr时抛出Capybara::Poltergeist::StatusFailError.复制步骤:$brewinstallphantomjs$geminstallcapybara$geminstallpoltergeist$geminstallselenium-webdriver$irbrequire'capybara/poltergeist'moduleDr

ruby-on-rails - 我可以在 render.js 上执行的 View 中使用 CoffeeScript 吗?

我需要做什么才能在RailsJSView中使用CoffeeScript?例如:defindexformat.js{render:layout=>false}end我需要做什么才能让Rails使用index.js.coffee? 最佳答案 Johnny的回答是正确的。如果您查看pullrequest链接到CoffeeBeans页面,你有dhh说Oncewehaveafast,cleanimplementation,it'swelcomeincore.3.2isamorelikelytarget,though.我在Railsconf上与

【笔记】internal/modules/cjs/loader.js:985 throw err; ^ Error: Cannot find module ‘node:util‘

[root@localhostusr]#cnpm-vinternal/modules/cjs/loader.js:985throwerr;^Error:Cannotfindmodule‘node:util’Requirestack:/usr/local/node/lib/node_modules/cnpm/bin/cnpmatFunction.Module._resolveFilename(internal/modules/cjs/loader.js:982:15)atFunction.Module._load(internal/modules/cjs/loader.js:864:27)atM

ruby - Capybara 麻烦填写 JS 模态

首先让我确认这不是重复的(因为那里发布的答案没有解决我的问题)。Thispost本质上是我的确切问题:Capybara无法在Stripe模式中找到表单字段来填写它们。这是我的capybara规范:describe'checkout',type::feature,js:truedoit'checksoutcorrectly'dovisit'/'page.shouldhave_content'Amount:$20.00'page.find('#button-two').click_button'PaywithCard'Capybara.within_frame'stripe_checkou

javascript - Rails js.erb 文件找不到方法 "render"

我在JavascriptERB文件中有以下代码:$(document).ready(function(){$("#workout-week").append("show_training_period",:locals=>{:period=>@period})%>);});当我到达View时,出现以下错误:undefinedmethod`render'for#:0x00000005dbfe98>partial存在,局部变量非nil。知道为什么会发生这种情况吗?堆栈跟踪:app/assets/javascripts/slider.js.erb:2:in`evaluate_source't

ruby-on-rails - Rails Assets 管道不包括 application.js list 中的必需文件

railsAssets管道不包括application.js中所需的文件。呈现给浏览器的唯一javascript文件是application.js,并且require行没有编译为包含标签,因为它们应该是://Thisisamanifestfilethat'llbecompiledintoapplication.js,whichwillincludeallthefiles//listedbelow.////AnyJavaScript/Coffeefilewithinthisdirectory,lib/assets/javascripts,vendor/assets/javascripts

ruby - Ruby 中有类似 null-stream 的东西吗?

我可以使用:File.open('/dev/null','w')在Unix系统上,但如果有Ruby方法来实现这一点,我想使用它。我只是在寻找一个I/O流,它会立即“丢弃”所有写入,有点像空对象。 最佳答案 如果你想要流的完整行为,最好的可能是使用:File.open(File::NULL,"w")请注意File::NULL是Ruby1.9.3的新功能;你可以用我的backportsgem:require'backports/1.9.3/file/null'#=>Won'tdoanythingin1.9.3+File.open(Fil

ruby-on-rails - rails respond_to format.js API

我是一名经验丰富的JAVA和C++开发人员,我正在努力了解Rails的工作原理。我得到以下代码:respond_todo|format|if@line_item.saveformat.html{redirect_tostore_url}format.js{render:json=>@line_item,:mime_type=>Mime::Type.lookup('application/json'),:callback=>'javascriptFunction'}我一直在搜索定义我可以在format.js{}中传递的内容的api,但我找不到..首先:format.js是什么语句,是变量

ruby - 为什么 "compass watch"说它无法加载 sass/script/node (LoadError)?

我的compasswatch命令有问题-直到几天前它都运行良好。我没有对我的配置文件进行任何更改。我重新安装了Compass,使用rvm更新了Ruby。我检查了我的custom_require.rb文件,但我真的不知道要查找什么。它似乎正在尝试从某处加载文件“sass/script/node”http://sass-lang.com/docs/yardoc/Sass/Script/Node.html我收集了文件路径-但我什么都没有。/Users/sampurcell/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygem

ruby - 一些 JS 运行后,如何让 Capybara 检查可见性?

加载页面后,我有代码运行并根据xhr返回的数据隐藏和显示各种项目。我的集成测试看起来像这样:it"shouldnotshowtheblah"dopage.find('#blah').visible?.shouldbe_trueend当我手动转到此测试运行的上下文中的页面时,#blah不如我所料可见。我怀疑Capybara正在查看页面的初始状态(在本例中是不可见的),评估DOM的状态并在JS运行之前测试失败。是的,我在包含的describeblock上设置了:js=>true:)任何想法将不胜感激!我希望我不必在这里故意延迟,这感觉不稳定并且会减慢速度。 最佳