在带有 Rails 3、Ruby 1.9.2 的 Windows 7 上运行自动测试时出错

发布于 2024-09-29 11:10:09 字数 859 浏览 2 评论 0原文

在 Windows 7 上安装和运行 Rails 3 和 Ruby 1.9.2 相当顺利。只是现在我想运行自动测试时才遇到问题。该错误看起来非常简单,但我不知道如何解决它。

我的 Gemfile 中有以下 gem:

gem 'autotest'
gem 'autotest-rails-pure'

但是当我运行 bundle exec autotest 时,我得到:

loading autotest/rails
style: Rails
C:\bin\Ruby192\bin\ruby -I.;lib;test -rubygems -e "['test/unit', 
'test/unit/helpers/users_helper_test.rb', 'test/unit/user_test.rb'].each 
{ |f| require f }" | C:/bin/Ruby192/lib/ruby/gems/1.9.1/gems/autotest-4.4.1/bin/unit_diff -u
'C:' is not recognized as an internal or external command, 
operable program or batch file.

所以某些路径的格式似乎出了问题,但我不确定在哪里以及如何来解决它。我尝试在 Cygwin 下运行它,但没有成功。

我还尝试使用 ZenTest gem 而不是 autotestautotest-rails-pure gem,并且运行了!但是,它没有检测到默认目录中的任何测试文件。所以这似乎也没有多大用处。

谁可以帮忙?

Installing and running Rails 3 and Ruby 1.9.2 on Windows 7 went rather smooth. It's only now that I want to run autotest that I'm running into problems. The error looks frustratingly simple, but I can't figure out how to solve it.

I have the following gems in my Gemfile:

gem 'autotest'
gem 'autotest-rails-pure'

But then when I run bundle exec autotest, I get:

loading autotest/rails
style: Rails
C:\bin\Ruby192\bin\ruby -I.;lib;test -rubygems -e "['test/unit', 
'test/unit/helpers/users_helper_test.rb', 'test/unit/user_test.rb'].each 
{ |f| require f }" | C:/bin/Ruby192/lib/ruby/gems/1.9.1/gems/autotest-4.4.1/bin/unit_diff -u
'C:' is not recognized as an internal or external command, 
operable program or batch file.

So something seems to go wrong in the formatting of some path, but I'm not sure where and how to solve it. I've tried running this under Cygwin, but to no avail.

I have also tried using the ZenTest gem instead of the autotest and autotest-rails-pure gems and that ran! However, it did not detect any if the test files in the default directories. So that seems to be of not much use either.

Who can help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执笔绘流年 2024-10-06 11:10:09

哦是的!我找到了解决方案!我在此设置中需要的 gem 是:

gem 'ZenTest'
gem 'autotest-rails-pure'

ZenTest gem 生成正确的命令行字符串(实际上只有管道后面的“unit_diff -u”,没有路径)。 autotest-rails-pure gem 找到正确的测试集。

Oh, yes! I found the solution! The gems I need in this setup are:

gem 'ZenTest'
gem 'autotest-rails-pure'

The ZenTest gem generates the correct command line string (which actually just has the "unit_diff -u" behind the pipe, without the path). The autotest-rails-pure gem finds the correct test set.

一抹苦笑 2024-10-06 11:10:09

我认为这与 Windows 命令 shell 解释路径名的方式有关。通常你可以用“/”代替“\”,它仍然有效,但当你也使用管道时显然不行。我敢打赌,如果您可以在失败的命令周围加上引号(以 C:/bin/Ruby192/... 开头),Windows 会将其识别为字符串。

I think this has to do with the way the Windows command shell interprets path names. Normally you can substitute "/" for "\" and it still works, but apparently not when you also use pipes. I'll bet if you can put quotes around the failing command (starting with C:/bin/Ruby192/...) Windows will recognize it as a string.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文