2013-04-09 40 views
13

当我跑我的叉勺RSpec的测试,我每次使用水豚的save_and_open_page时间,叉勺是失去测试套件..也许犯规输出什么了......save_and_open_page和叉勺,叉勺是失去的测试套件/输出

查看日志

# => without save_and_open_page 
09:04:24 - INFO - Spork server for RSpec, Test::Unit successfully started 

09:04:24 - INFO - Guard::RSpec is running 
09:04:24 - INFO - Running all specs 
Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec"]... 
................ 

Finished in 4.1 seconds 
16 examples, 0 failures 


Randomized with seed 50331 

Done. 

# => with save_and_open_page, no .... are shown anymore 
09:04:29 - INFO - Guard is now watching at '/Users/myuser/coding/myproject' 
09:04:39 - INFO - Running: spec/features/registration/registration_process_spec.rb 
Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]... 
Done. 

# => without save_and_open_page, also no .... anymore (after restart it works again) 
[1] guard(main)> Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]... 
Done. 

    # => here i added some errors into my code... still no error message shown... 
[1] guard(main)> Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]... 
Done. 

# only works again after restarting spork 

有什么建议吗?

+0

我创建GitHub上的问题:https://github.com/sporkrb/spork/issues/226 – Lichtamberg 2013-05-17 16:24:36

回答

1

不知怎的,你的STDOUT正在被一些其他缓冲区替换。因此,无论是由水豚写入标准输出都被忽略或消耗在其他地方。

尝试以下操作:

# Add global before/after blocks 
before :each do 
    @old_stdout, @old_stderr = STDOUT, STDERR 
end 

after :each do 
    STDOUT, STDERR = @old_stdout, @old_stderr 

    # Some gems use $stdout and $stderr, instead of STDOUT and STDERR, replace those too 
    $stdout, $stderr = @old_stdout, @old_stderr 
end 

水豚的save_and_open_page使用Launchy宝石。所以我相信STDOUTSTDERR在其中一个宝石中变得残存。

+0

HM我会investiate这进一步。 ..谢谢你的回答,我会标记它,当我知道更多! – Lichtamberg 2013-05-27 20:54:26

+0

@Lichtamberg,我尝试了上述解决方案,但无法使其正常工作。你能解决这个问题吗?我会很感激任何指针.. – lnreddy 2013-06-23 07:35:34

+0

不,它也没有为我工作.. – Lichtamberg 2013-06-24 12:10:13