小编Cra*_*gan的帖子

尝试使用Cucumber功能中的"示例"部分时解析问题

在谷歌搜索此错误消息没有运气

features/manage_hand_evaluator.feature:features/manage_hand_evaluator.feature中的解析错误:21.在期待以下之一时找到示例:comment,py_string,row,scenario,scenario_outline,step,tag.(现状:步骤).(小黄瓜::分析器:: ParseError)

这是我为示例部分设置的(此时没有其他方案,只是在"功能:"部分之后的这个方案)

...

Scenario: Evaluating for current straights
  Given I am a player with <hand>
  When the board is <board>
  Then the current possible straights should be <possibles>

  Examples:
    | board | hand |    possibles                  | 
    | A23   | 45   | A2345                         | 
    | 3456  | 23   | A2345,23456,34567,45678       | 
    | 789T  | A2   | 56789,6789T,789TJ,89TJQ       | 
    | 45678 | 23   | 23456,34567,45678,56789,6789T | 
Run Code Online (Sandbox Code Playgroud)

我也已经为那些"Given,When,Then"行设置了步骤定义(当我替换时测试通过,并且有一些文本并注释掉"Examples"部分).所以似乎步骤定义设置得恰当,只是因为我在.feature文件中的内容存在某种解析问题,我无法弄清楚我做错了什么.

相关的宝石安装:小黄瓜(2.1.5)(尝试2.2.0,但它与我的黄瓜版本打破)黄瓜(0.8.5)黄瓜 - 铁路(0.3.2)导轨(2.3.8)

ruby ruby-on-rails cucumber gherkin

28
推荐指数
1
解决办法
8614
查看次数

回形针不保存,没有错误

我跌跌撞撞 - 经历了文档,教程等,我不确定我做错了什么.

该项目中的另一个模型是为Paperclip设置的,并在测试时起作用.它将附件文件信息保存并检索到数据库中,并将文件放入公共/系统内的子文件夹中.我基本上将相关代码复制到我正在处理的模型上

该模型具有以下行:

has_attached_file :document
Run Code Online (Sandbox Code Playgroud)

该模型链接到的表具有必要的列:

document_file_name 
document_content_type
document_file_size
document_updated_at
Run Code Online (Sandbox Code Playgroud)

编辑视图有这个(以haml为单位):

%h1 Knowledge Base: Edit Article
= message_block :on => @article

- form_for(@article, :url => knowledge_base_article_path(@article),  :html => {:multipart => true}) do |f|

  #knowledgebase.clearfix
    %label Upload KB Document:
    %br
    = f.file_field :document
    - if @article.document.exists?
      %p
        = link_to "Current KB Attachment", @article.document.url
      %p
        = f.check_box :remove_document
  <br>

  = render :partial => "form", :locals => {:f => f}
  = submit_tag "Save changes"
  = link_to "Cancel", knowledge_base_article_path(@article)
Run Code Online (Sandbox Code Playgroud)

当我保存模型实例时,我可以在日志中看到Rails知道我要上传的文件:

Processing KnowledgeBase::ArticlesController#update …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails paperclip

4
推荐指数
1
解决办法
4032
查看次数

SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:Mac上的证书验证失败

在Mac OSX 10.7.5上使用Homebrew

$ brew install openssl
Error: openssl-1.0.1e already installed

$ rake test.rake
rake aborted!
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

我承认还有其他问题,例如标题中的问题,但解决方案似乎都没有效果.我在各个方面尝试过这些,没有成功:

rvm pkg install openssl
rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr
rvm remove 1.9.3
brew install openssl
rvm install 1.9.3 --with-openssl-dir=`brew --prefix openssl`

我决定检查openssl版本并注意到这一点:

$ openssl version
OpenSSL 0.9.8r 8 Feb 2011

希望这确实是问题,修复就像确保我的笔记本电脑检测到正确的OpenSSL一样简单.

但是我如何解决这个问题,所以我使用Homebrew的新OpenSSL呢?

提前致谢.

ruby homebrew openssl ruby-on-rails rvm

4
推荐指数
2
解决办法
6129
查看次数

使用 net-ldap 从 AD 组中删除成员

从 AD 组中删除用户的正确方法(步骤)是什么?在这种情况下,我是在 Rails 项目中使用 net-ldap gem 进行的。

最初,我打算修改用户的“memberof”值(从“memberof”字段中的组 DN 数组中删除该特定组),但我了解到“memberof”是只读的。

我对 LDAP 的概念有点陌生,所以我不确定标准做法是什么。

提前致谢!

ruby ldap ruby-on-rails active-directory ruby-on-rails-3

3
推荐指数
1
解决办法
1568
查看次数