簡體   English   中英

我應該如何在minitest rails3.2之前加入?

[英]How should I include before do in minitest rails3.2?

在minitest中寫之前的寫法是什么?

我試圖在rails3.2中使用minitest編寫測試用例。

在開發環境中,我們使用一些后台作業加載此數據。 所以,我也嘗試在測試環境中做同樣的事情。 在運行我的測試套件之前,我必須在后台運行任務並生成活力數據,並在測試套件中使用相同的斷言。 但是,它為CommunityVibrancyTest拋出未定義的方法`之前':Class(NoMethodError)

   require 'test_helper'

   Class CommunityVibrancyTest < ActiveSupport::TestCase

     before :each do
       App::Queue.add(CommunityVibrancyWorker, communities(:private_community).id )
     end

     test 'to check whether the vibrancy of a private community is handliing share or not' do

       private_community = communities(:private_community)
       share = shares(:share_for_private_microblog)
       stat = share.object
       post_vibrancy = stat.aggregated_score_mblog.round(1)
       assert_equal post_vibrancy, private_community.community_vibrancies.last.post_vibrancy
     end
   end

test / unit / community_vibrancy_test.rb:24:in <class:CommunityVibrancyTest>': undefined method來自test / unit / community_vibrancy_test.rb的'for CommunityVibrancyTest:Class(NoMethodError)之前的<class:CommunityVibrancyTest>': undefined method :4:in''

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM