阿鲁巴黄瓜测试(ruby1.9.2) [英] Aruba cucumber tests (ruby1.9.2)

查看:274
本文介绍了阿鲁巴黄瓜测试(ruby1.9.2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 aruba gem,它是黄瓜的延伸。它允许您测试命令行应用程序 - 如Rails中的生成器(但是,如文档指出,您可以将其用于任何cmd应用程序)。

I've just installed the aruba gem which is an extension to cucumber. It allows you to test command line applications - like generators in Rails (but, as the documentation points out, you could use it for any cmd app).

此关键实验室文章 a>关于使用它,但由于某种原因,它不会超过第一步:第一步是绿色(应用程序的创建),但下面的步骤尝试 cd test_app 并且找不到它并且失败。

I have been following this pivotal labs article about using it, but for some reason it doesn't get past the first step: the first step is green ( the creation of the app ), but the following step tries to cd test_app and can't find it and fails.

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"'

看起来应用程序文件夹正在创建,虽然看基本dir我可以看到tmp / aruba / folding 。在戳了一会儿,我不能提出任何东西为什么。$ b $

It would appear that the application folder isn't actually being created, although looking in the base dir I can see the tmp/aruba/ folding is . After poking around the source for a while I can't come up with anything as to why. Has anybody else had any experience with this gem and found the same thing?

有没有什么好的BDD替代测试生成器或rake任务等?

Are there any nice BDD alternatives to testing generators or rake tasks etc?

继续Ryans回答:

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

Once I added the following to the features/support/env.rb (working from the base rails directory):

Before do
  @dirs = [File.expand_path(File.dirname(__FILE__) + '/../../../aruba_test_dir')]
end

这样黄瓜正在构建当前rails应用程序的外部应用程序,这解决了这个问题。

So that cucumber is building the app outside of the current rails app, this fixes the issue.

推荐答案

我的初步想法:我想是什么会导致这是如果Rails不在你的包内。但你似乎是一个聪明的人,所以我试着复制你的例子,发现我有同样的事情。

My initial thoughts: I think what would cause this is if Rails wasn't inside your bundle. But you seem like a smart man and so I tried duplicating your example and found that I got the same thing.

困惑,我确保我得到输出: / p>

Puzzled, I made sure that I was getting output:

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的一个错误。我不知道是哪个。

It turns out by simply observing that the output contains app/mailers that this process works. It's very quantum and most probably a bug in Aruba or Rails. I'm not sure which.

这篇关于阿鲁巴黄瓜测试(ruby1.9.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆