Tag:

如何使用Cucumber-Capybara断言是否存在闪存变量?

我正在使用Cucumber和Capybara运行Rails 3.0.7项目,我有一个步骤定义,检查是否存在flash [:error]: Then /^I should be able to see the main page properly$/ do current_path.should == “/” flash[:error].should == nil end 当我进行黄瓜测试时,我收到错误 And I should be able to see the main page properly # features/step_definitions/user_auth_steps.rb:17 undefined method `flash’ for nil:NilClass (NoMethodError) ./features/step_definitions/user_auth_steps.rb:19:in `/^I should be able to see the main page properly$/’ features/user_auth.feature:10:in `And […]

静态站点生成器基于目录和文件

我正在寻找一种在ruby中生成嵌套网站结构的好方法。 我想要一些我可以向客户提出的东西,而不是msword文档。 forms的东西: Home/ index.txt About.txt Services/ index.txt products.txt blahblah.txt .txt文件是markdown,或者其他什么。 我实际上想将它导入到cms系统中,只想挂钩到我可以使用的静态站点生成器。 否则我会自己做,但是使用其他东西与html预处理器等集成会很好。

presenter rails中的未定义方法`content_for’

我在rails中使用一个presenter来显示一个保存在yml文件中的数据。 (i18ngem) 这是控制器 – class DocumentsController < ApplicationController def index @presenter = DocumentPresenter.new end end 这是我的看法 – = @presenter.viewname 这是我的主持人 – class DocumentPresenter def viewname content_for :secondary_nav_title do t(‘Documents’) end end end 错误说: 未定义的方法`content_for’ 为什么rails不识别演示者中的content_for ?