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

查看:23
本文介绍了Aruba 黄瓜测试 (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).

我一直在关注 这篇关于使用它的关键实验室文章,但由于某种原因,它没有通过第一步:第一步是绿色的(应用程序的创建),但下面的步骤尝试 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"'

看起来应用程序文件夹实际上并没有被创建,尽管在基本目录中我可以看到 tmp/aruba/折叠 is .在探查了源头一段时间后,我想不出任何原因.有没有其他人对这个宝石有任何经验并发现了同样的东西?

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 的进一步回答:

Further to Ryans answer:

一旦我将以下内容添加到 features/support/env.rb(从基础 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

因此 cucumber 在当前 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.

困惑,我确定我得到了输出:

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.

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

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