2010-06-14 74 views
0

我試圖運行基本的單元測試。未在Rails中運行的測試套件2.3.5

當我運行rake test:units時,輸出最初顯示正在加載的文件,即rake_test_loader,* _test.rb。 但是之後沒有輸出。該任務退出,沒有錯誤。

我也嘗試單獨運行一個測試> ruby​​單元/ some_test.rb 這也沒有輸出。

任何想法爲什麼測試套件沒有運行?

這裏的test_helper:

ENV["RAILS_ENV"] = "test" 

require File.expand_path(File.dirname(__FILE__) + "/../config/environment") 
require 'test_help' 

class ActiveSupport::TestCase 

    self.use_transactional_fixtures = false 

    self.use_instantiated_fixtures = false 

    #fixtures :all 

    # Add more helper methods to be used by all tests here... 
end 

和這裏的基本測試:

require 'test_helper' 

class SomeTest < ActiveSupport::TestCase 
    # Replace this with your real tests. 
    test "the truth" do 
    assert false 
    end 
end 

回答

1

嘗試把gem 'test-unit'require 'test_help'前將test_helper.rb

+0

我沒有測試單元寶石,所以我安裝了它,並嘗試添加該行,但仍然沒有快樂。 – johnnypez 2010-06-14 14:15:41

+0

我以前有過這個問題,我以爲那是我解決問題的方法。不幸的是我不能在任何我的Ruby環境中重現這一點。您也可以嘗試在'gem'test-unit''行之後添加'require'test/unit''並嘗試'test_helper.rb'頂部的這兩行。最後,你最近是否運行過'gem update'? – 2010-06-15 06:15:43

+0

謝謝!只要在'test_helper.rb'中加入'require'test/unit''就可以解決這個問題。 – ilasno 2012-10-18 23:55:54