2011-09-24 95 views
13

运行所有模型测试时发现rubyMine'MiniTest框架'错误'。ruby​​Mine'无法附加测试记者测试框架'

我可以在常规命令行运行所有模型测试。 例如rake spec:models
当我使用rubyMine:
我可以运行一个模型测试好的。
然而,当我尝试运行模型中的所有测试中,我得到
MiniTest framework was detected. It is a limited version of original Test::Unit framework. RubyMine/IDEA Ruby plugin test runner requires full-featured version of the framework, otherwise default console tests reporter will be used instead. Please install 'test-unit' gem and activate it on runtime.

我尝试添加了“测试单元”我的Gemfile和rebundling但现在得到:

`/home/durrantm/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) 
    /home/durrantm/Downloads/RubyMine-3.2.3/rb/testing/runner/tunit_in_folder_runner.rb 
Testing started at 9:33 AM ... 
Work directory: /home/durrantm/Dropbox_not_syncd/webs/3/rubyists/spec/models} 
Loading files.... 
========================================= 
0 files were loaded. 
========================================= 
Searching test suites... 
========================================= 
0 test suites, 0 tests, 0 assertions, 0 failures, 0 errors 
Process finished with exit code 0` 

注:有趣}在工作目录中。我仍然得到Unable to attach test_reporter to test fraemwork message

版本:Ubuntu的的RubyMine 3.2

回答

11

我终于得到了这个工作。 主要通过更改菜单下的东西:
运行 - >编辑配置 - >点击Rspec - >创建一个新的配置。

对于确保规格文件夹指向应用程序规格模型的新配置。

最后一步(实际得到它工作的那一步)是将工作目录(仍在运行/调试配置屏幕上)设置为我的应用程序根目录!

我还做过的其他事情是将gem 'test-unit'添加到Gemfile中,然后捆绑它。然而,后来的测试(删除它和unbundling)表明它并不需要,实际上是使用空套件多次运行测试(可能尝试默认unit :: test以及运行rspec)。

+1

我有一个类似的问题http://stackoverflow.com/questions/7575057/exception-message-no-such-file-to-load-in-rails-application,我的工作目录指向应用程序的根目录。请帮忙。谢谢! – Ava

+0

这也解决了我的问题:/usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in'require':can not加载这样的文件 - spec_helper(LoadError) –

3

在我的系统上,问题是“红绿”宝石。它会根据成功或失败自动为进度标记(点)和Test :: Unit摘要消息着色。 RubyMine中必须有一些东西试图解析Test :: Unit结果(我想象的是“rake test”的输出结果),并且它在ANSI序列上窒息。

我在我的test/test_helper.rb中注释了“require'redgreen'”,问题就消失了。我真的很喜欢redgreen从外壳执行“耙测试”,虽然,所以我把这个test_helper,使之成为既“耙测试”和RubyMine的范围内工作:

require 'redgreen' if $stdin.tty?

它可能无法redgreen这是造成你的问题,但怀疑任何可能产生非常规Test :: Unit输出的东西。

祝你好运!

4

我也有这个问题,但解决它不同于其他海报。

在rubymine中,我添加了minitest-reporter宝石。然后在我的minitest_helper.rb我增加了以下内容:

require "minitest/reporters" 
MiniTest::Unit.runner = MiniTest::SuiteRunner.new 
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new 
+0

虽然我无法让RubyMine自动包含'* _helper.rb'脚本,但必须在规范中执行才能运行。一个有用的指导也将[这一个](http://confluence.jetbrains.net/display/RUBYDEV/RubyMine+4.0+Beta+3+%28build+113.2%29+Release+Notes),一定要使用** Minitest **运行配置并设置运行目录,如上述答案中所述 – Dr1Ku

+1

由于未定义MiniTest :: SuiteRunner,所以这对我并不适用。但是,http://www.jetbrains.com/ruby/webhelp/minitest.html说我需要使用以下版本“0.8.0及更高版本”,它的工作原理: 'require'minitest/reporter'; MINITEST :: Reporters.use!' – Anton

0

对于我来说,我通过确保文件正确命名解决了这个问题。需要从单词测试开始或以单词测试结束。这真的取决于测试配置下的“测试文件名掩码”。对我来说,我的是:* /{ _test,测试_ *} RB

例:test_case_01.rbcase_01_test.rb