我有一个安装了 spork-rails 和 spork-minitest 的 Rails 3.2 项目。我还有一个使用命令成功运行(尽管速度很慢)的集成测试rake test:integration
。
现在,spork 在端口 8988 上运行,我尝试通过 testdrb 运行测试:
$ bundle exec testdrb -Itest test/integration/**/*_test.rb
No examples found.
Finished in 0.00141 seconds
0 examples, 0 failures
Randomized with seed 35511
Exception encountered: #<SystemExit: exit>
backtrace:
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:326:in `exit'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork.rb:77:in `call'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork.rb:77:in `exec_after_each_run'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:14:in `block in run'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/forker.rb:21:in `block in initialize'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/forker.rb:18:in `fork'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/forker.rb:18:in `initialize'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:in `new'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:in `run'
/home/mike/.rvm/gems/ruby-1.9.3-p286@myproject/gems/spork-1.0.0rc3/lib/spork/server.rb:48:in `run'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/home/mike/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
同时,Spork 终端输出一个成功的测试运行:
Running tests with args ["-Itest/", "test/integration/admin/user_test.rb"]...
Run options:
# Running tests:
Finished tests in 1.551147s, 0.6447 tests/s, 0.6447 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Done.
除了这个 SystemExit 错误之外,基本上一切都在工作。它似乎来自 minitest 自动运行代码,它安装了一个 at_exit 处理程序,然后在该处理程序中调用 exit()。我能做些什么来摆脱这个错误吗?