Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 阿鲁巴黄瓜试验(ruby1.9.2)_Ruby On Rails_Cucumber_Bdd_Ruby On Rails 3 - Fatal编程技术网

Ruby on rails 阿鲁巴黄瓜试验(ruby1.9.2)

Ruby on rails 阿鲁巴黄瓜试验(ruby1.9.2),ruby-on-rails,cucumber,bdd,ruby-on-rails-3,Ruby On Rails,Cucumber,Bdd,Ruby On Rails 3,我刚刚安装了gem,它是cucumber的一个扩展。它允许您测试命令行应用程序,比如Rails中的生成器(但是,正如文档所指出的,您可以将其用于任何cmd应用程序) 我一直在关注如何使用它,但出于某种原因,它没有通过第一步:第一步是绿色的(创建应用程序),但下一步尝试cd-test\u-app,但找不到它并失败 Given I run "rails new test_app" # features/step_definitions/aruba_step

我刚刚安装了gem,它是cucumber的一个扩展。它允许您测试命令行应用程序,比如Rails中的生成器(但是,正如文档所指出的,您可以将其用于任何cmd应用程序)

我一直在关注如何使用它,但出于某种原因,它没有通过第一步:第一步是绿色的(创建应用程序),但下一步尝试
cd-test\u-app
,但找不到它并失败

Given I run "rails new test_app"                       # features/step_definitions/aruba_steps.rb:95
And I cd to "test_app"                                 # features/step_definitions/aruba_steps.rb:91
  tmp/aruba/test_app is not a directory. (RuntimeError)
  ./features/step_definitions/aruba_steps.rb:92:in `/^I cd to "([^"]*)"$/'
  features/generators.feature:9:in `And I cd to "test_app"'
看起来应用程序文件夹实际上并没有被创建,尽管在base dir中我可以看到tmp/aruba/folding是。在对来源进行了一段时间的探索之后,我想不出任何原因。 有没有其他人有过这种宝石的经验并发现了同样的东西

除了测试生成器或rake任务等,还有什么好的BDD替代方案吗

关于Ryans的回答:

一旦我将以下内容添加到
功能/support/env.rb
(从基本rails目录工作):


cucumber在当前rails应用程序之外构建应用程序,这解决了问题。

我最初的想法:如果rails不在您的包中,我认为会导致这种情况。但是你看起来像个聪明人,所以我试着复制你的例子,发现我得到了同样的结果

困惑的是,我确定自己得到了输出:

Scenario: title
  Given I run "rails new test_app"
  Then the output should contain:
    """
      app/mailers
    """
  And I cd to "test_app"

通过观察输出中包含的app/mailers,可以发现这个过程是有效的。这是非常量子的,很可能是Aruba或Rails中的一个bug。我不知道是哪个

D**ned波函数。谢谢
Scenario: title
  Given I run "rails new test_app"
  Then the output should contain:
    """
      app/mailers
    """
  And I cd to "test_app"