我正在尝试使用我的rails项目进行自动测试,但我仍然遇到不同的错误。
我的设置:
首先我应该安装什么宝石?
我遇到了一堆不同的自动测试宝石并尝试了一堆不同的组合,但似乎没有任何工作。
我试过
但也
(源)
我有几个不同的失败,但我得到的最常见的是以下
c:\RailsInstaller\Ruby1.9.2\bin\ruby -I.;lib;test -rubygems -e "['test/unit', 'test/functional/status_controller_test.rb
', 'test/unit/helpers/status_helper_test.rb', 'test/unit/helpers/home_helper_test.rb', 'test/unit/user_test.rb', 'test/f
unctional/home_controller_test.rb', 'test/functional/playlists_controller_test.rb', 'test/unit/playlist_test.rb', 'test/
functional/registrations_controller_test.rb', 'test/unit/song_test.rb', 'test/unit/helpers/about_helper_test.rb', 'test/
unit/helpers/playlists_helper_test.rb', 'test/functional/songs_controller_test.rb', 'test/unit/helpers/registrations_hel
per_test.rb', 'test/unit/helpers/songs_helper_test.rb', 'test/functional/about_controller_test.rb'].each { |f| require f
}" | ruby c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/autotest-standalone-4.5.9/bin/unit_diff -u
c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/turn-0.8.3/lib/turn/autorun/minitest.rb:14:in `<top (required)>': MiniTest v1.6.0 is out of date. (RuntimeError)
`gem install minitest` and add `gem 'minitest' to you test helper.
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/turn-0.8.3/lib/turn.rb:13:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/test_help.rb:19:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from c:/RailsProjects/songrake/test/test_helper.rb:3:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from c:/RailsProjects/songrake/test/functional/status_controller_test.rb:1:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from c:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from -e:1:in `block in <main>'
from -e:1:in `each'
from -e:1:in `<main>'
我还尝试将gem "minitest"
(具有不同版本号)的变体添加到我的gemfile中。我还尝试将一些其他gem文件添加到gemfile中。
无论如何都喜欢使用这个工具!谢谢你的帮助!
答案 0 :(得分:3)
感谢这个问题,我能够弄明白......
Error running autotest on Windows 7 with Rails 3, Ruby 1.9.2
您需要的只是ZenTest宝石和自动测试纯宝石。
然后将以下内容添加到gemfile
:
group :test do
gem 'ZenTest'
gem 'autotest-rails-pure'
gem 'minitest'
end
而不是仅仅从命令行运行"$ autotest"
,您需要运行"$ bundle exec autotest"
我不明白捆绑执行官做了什么但是我发现了一个探索 http://gembundler.com/
捆绑执行
运行捆绑包中附带gem的可执行文件
$ bundle exec rspec spec/models
在某些情况下,如果可执行文件恰好安装在您的系统中并且没有引入任何与您的软件包冲突的gem,那么运行没有bundle exec的可执行文件可能会有效。
然而,这是不可靠的,并且是相当痛苦的根源。即使它看起来有效,但它可能在将来或其他机器上不起作用。