2013-04-25 3 views

उत्तर

19

समाधान आपके zeus.json फ़ाइल को संशोधित करके एक नया कंसोल कमांड शामिल करने के लिए हासिल किया जाता है जो परीक्षण वातावरण में चलाएगा जिसे मैंने test_console कहा है।

{ 
    "command": "ruby -rubygems -r./custom_plan -eZeus.go", 

    "plan": { 
    "boot": { 
     "default_bundle": { 
     "development_environment": { 
      "prerake": {"rake": []}, 
      "runner": ["r"], 
      "console": ["c"], 
      "server": ["s"], 
      "generate": ["g"], 
      "destroy": ["d"], 
      "dbconsole": [] 
     }, 
     "test_environment": { 
      "cucumber_environment": {"cucumber": []}, 
      "test_helper": {"test": ["rspec", "testrb"]}, 
      "test_console": ["tc"] 
     } 
     } 
    } 
    } 
} 

तथापि test_console सक्षम करने के लिए, आप अपने custom_plan में एक कस्टम योजना बनाने की आवश्यकता होगी:

यहाँ मेरा पूरा zeus.json फ़ाइल, केवल प्रासंगिक सा हिस्सा "test_console" के साथ शुरू किया जा रहा है .rb फ़ाइल इस प्रकार है:

require 'zeus/rails' 

class CustomPlan < Zeus::Rails 
    def default_bundle_with_test_env 
    ::Rails.env = 'test' 
    ENV['RAILS_ENV'] = 'test' 
    default_bundle 
    end 

    def test_console 
    console 
    end 
end 

Zeus.plan = CustomPlan.new 

नोट default_bundle_with_test_env की जरूरत है, के रूप में test_console तरीका है जिसके ऊपर परिभाषित किया गया है आपके zeus.json फ़ाइल में।

अंत में, चलाएं: zeus test_console या zeus tc

संबंधित मुद्दे