ubuntu 上的自动测试什么也不做
运行 $autotest 或 $autotest -f 会得到相同的结果:
# Waiting since [timestamp]
更改控制器或规范文件只会重复该行(使用较新的时间戳)。如果我尝试 $autotest -v,它不会在没有测试匹配的文件列表中包含规范或控制器,我认为这很好;但除了 #waiting 行之外,它没有显示任何其他内容。
如果我在运行 -v 时对规范或控制器进行更改,则输出是重复两次的哈希值 {[path/to/changed/file] => [时间戳]}。
这是 Ubuntu 9.04、Ruby 1.9.2、Rails 3、autotest 4.3.2、autotest-rails 4.1.0 和 rspec 2.0.0.beta.20。 (我还应该说 rspec /spec 本身就可以很好地工作。)有什么想法吗?
Running either $autotest or $autotest -f gives the same result:
# Waiting since [timestamp]
Changing a controller or spec file just gets that line repeated (with a newer timestamp). If I try $autotest -v, it does not include the spec or controller among the list of files for which no tests match, which I suppose is good; but it doesn't show anything else besides the #waiting line.
If I make a change to a spec or controller while running -v, the output is a hash repeated twice with {[path/to/changed/file] => [timestamp]}.
This is Ubuntu 9.04, Ruby 1.9.2, Rails 3, autotest 4.3.2, autotest-rails 4.1.0, and rspec 2.0.0.beta.20. (I should also say that rspec /spec on its own works fine.) Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
啊哈!我这样做是我第一次使用 rvm 实验的一部分,但我将 ZenTest 作为 /usr/lib/ruby 中的 gem。即使我将“rvm use ___”设置为我想要的宝石集(带有自动测试和 autotest-rails-pure gems 的宝石集)后,命令“autotest”仍然在 /usr/bin/autotest 中获取旧版 ZenTest 中的文件已经到位。因此,对于关注railstutorial.org 的任何人来说,请确保您没有在rvm 之前使用(或从sudo gem 安装)中使用的gem,这些gem 会将文件留在您不希望的地方。
对我来说,“sudo gem uninstall ZenTest”就可以解决问题。
Aha! I was doing this as part of my first experiment with rvm, but I had ZenTest as a gem in /usr/lib/ruby. Even after I set 'rvm use ___' to the gemset I wanted - the one with the autotest and autotest-rails-pure gems - the command 'autotest' was still picking up the file at /usr/bin/autotest that the older ZenTest had put in place. So for anybody following the railstutorial.org - make sure you don't have gems from pre-rvm use (or from sudo gem installs) that are leaving files in places you don't expect.
For me, 'sudo gem uninstall ZenTest' turned out to do the trick.
我有完全相同的环境,除了 Windows 而不是 Ubuntu。我也有同样的问题。我确定它实际上并没有使用我这样设置的rails_app/autotest/discover.rb(尝试更改顺序,没关系,添加输出语句,但它们从未运行。):
我找到了解决方案:
在我的 Gemfile 中我已经指定了 ZenTest,并且需要将其替换为这些美女(autotest-rails 取决于 ZenTest,但这使一切变得不同):
现在它可以工作了(几乎但至少现在我有一个不相关的“Windowsy”问题) 。我想这会对你有帮助!
嗯,
autotest
仍然不起作用,但是bundle exec autotest
可以,这已经足够好了!I have the exact same environment, except Windows instead of Ubuntu. I am having the same problem. I determined that it is not actually using the rails_app/autotest/discover.rb I setup like this (tried changing order, didn't matter, added output statements and they never got run.):
I found the solution:
in my Gemfile for bundler I had specified ZenTest, and needed to swap it out for these beauties (autotest-rails depends on ZenTest, but this made all the difference):
And now it works (almost but at least now I have an unrelated 'Windowsy' problem). I think this will help you!
Well
autotest
, still doesn't work, butbundle exec autotest
does, and that's good enough!通过将以下内容添加到我的 autotest/discover.rb 文件中解决了我的问题:
这将强制自动测试加载所有文件,并在您保存对应用程序文件或规范文件的更改时正确触发规范。
我在这里写了一篇博客: http://itshouldbeuseful.wordpress.com/2011/03/08/force-autotest-to-load-all-your-application-files/
My problem was solved by adding the following to my autotest/discover.rb file:
This will force autotest to load all your files and correctly fire your specs when you save a change to either an application file or a spec file.
I blogged about it here: http://itshouldbeuseful.wordpress.com/2011/03/08/force-autotest-to-load-all-your-application-files/