草庐IT

host_example

全部标签

ruby - 为 capybara 设置 app_host 的内容

我的测试尝试访问网页并验证页面上是否存在某些元素。例如,它访问http://foo.com/homepage.html并检查Logo图像,然后访问http://bar.com/store/blah.html并检查页面上是否出现了某些文本。我的目标是访问经过Kerberos身份验证的网页。我发现Kerberos代码如下:主文件uri=URI.parse(Capybara.app_host)kerberos=Kerberos.new(uri.host)@kerberos_token=kerberos.encoded_tokenkerberos.rb文件classKerberosdefini

ruby-on-rails - 在 Rails/Capybara/Poltergeist 规范中使用 url_for 将驱动程序发送到 example.com 而不是应用程序

如果我在功能规范中调用url_for,它会返回一个以http://www.example.com/开头的绝对URL.Capybara会很乐意尝试加载该站点上的页面,但这与我的应用程序无关。以下是重现该问题的最少步骤:从这个Gemfile开始:source'https://rubygems.org'gem"sqlite3"gem"jquery-rails"gem"draper"gem"rails",'4.1.0'gem"therubyracer"gem"uglifier"gem"rspec-rails"gem"capybara"gem"poltergeist"gem"launchy"运行

ruby-on-rails - Rails SSL 问题 : (https://example. com) 与 request.base_url (http ://example. com) 不匹配

我刚刚在我的网站上安装了SSL证书。不幸的是,它破坏了登录功能。在网站上提交登录表单后,它只是重定向到主页。检查Rails日志显示此错误:(https://example.com)didn'tmatchrequest.base_url(http://example.com)这是我的虚拟主机文件。我想我需要以某种方式强制使用SSL?ServerNameexample.comServerAliaswww.example.comRedirectpermanent/https://example.com/ServerAdminhello@example.comServerNameexample

ruby-on-rails - 缺少要链接的主机!请提供 Rails 4 的 :host parameter,

Missinghosttolinkto!Pleaseprovidethe:hostparameter,setdefault_url_options[:host],orset:only_pathtotrue我偶尔会出现这个错误,一般重启服务器会修复一段时间,然后又会出现。我已经添加了config.action_mailer.default_url_options="localhost:3000",在development和test.rb文件中。此外,我还使用了includeRails.application.routes.url_helpers在一个访问路由的模块中,我读到这可能是我收到

ruby-on-rails - 我如何解决 "Missing host to link to! Please provide the :host parameter"? (返回率)

我正在关注RoRTutorial我被困在Listing9.15运行'bundleexecrspecspec/'后出现以下错误:1)AuthenticationauthorizationaswrongusersubmittingaPATCHrequesttotheUsers#updateactionFailure/Error:specify{expect(response).toredirect_to(root_url)}ArgumentError:Missinghosttolinkto!Pleaseprovidethe:hostparameter,setdefault_url_opti

ruby-on-rails - Rails : how to get the current host, 或用它构建 URL?

这个问题在这里已经有了答案:GettingtheHostnameorIPinRubyonRails(12个答案)关闭8年前。我需要使用主机构建具有不同端口的URL。例如,如果主机是example.com,我需要生成类似http://example.com:8080/的URL我需要它是便携的,所以当我在本地环境中时,它会显示http://localhost:8080/相反。有什么想法吗?

ruby - bundle gem : rspec says 'No examples found'

我正在将ruby​​onrails项目的一部分移植到gem中。我已经使用bundlegem创建了新的gem目录。对于lib和spec目录,gem的项目布局如下所示:|-lib||-mylib|||-MYCLASS.rb|||-version.rb||||-mylib.rb||-spec|-spec_helper.rb|-mylib|-test_MYCLASS.rbspec/spec_helper.rb的内容:require"mylib"RSpec.configuredo|config|endmylib.gemspec的相关部分,由bundlegem命令生成:spec.files=`gi

ruby - Rails : Good Rspec2 example usage?(还有 : Cucumber, Pickle,Capybara)

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于StackOverflow来说是偏离主题的,因为它们往往会吸引自以为是的答案和垃圾邮件。相反,describetheproblem以及迄今为止为解决该问题所做的工作。关闭8年前。Improvethisquestion我正在寻找一个相当新的开源应用程序,它使用Rspec2作为测试库。我想看看有经验的开发人员如何正确地利用该库来测试整个堆栈,因为我一直对自己的知识有疑问(来自testunit,部分原因是最新Rspec版本的文档相当稀疏,甚至尽管它在不断

ruby-on-rails - 尝试在 Cucumber 功能中使用 "Examples"部分时解析问题

谷歌搜索此错误消息时运气不佳features/manage_hand_evaluator.feature:features/manage_hand_evaluator.feature:21处的解析错误。在期望以下之一时找到示例:评论、py_string、行、场景、场景大纲、步骤、标签。(当前状态:步骤)。(小cucumber::解析器::ParseError)这是示例部分的设置(此时没有其他场景,只有“功能:”部分之后的这个场景)...Scenario:EvaluatingforcurrentstraightsGivenIamaplayerwithWhentheboardisThent

ruby - "include_examples"和 "it_behaves_like"有什么区别?

在RSpec中,it_behaves_like和include_examples有什么区别?documentation说:include_examples—include(s)theexamplesinthecurrentcontextit_behaves_like"name"—include(s)theexamplesinanestedcontext但这到底是什么意思呢?用另一个替换一个似乎对我的测试是通过还是失败没有影响。在某些情况下是否有理由偏爱其中一个?此外,it_should_behave_like和it_behaves_like只是同义词吗? 最