2013-04-25 14 views

cevap

19

Çözüm, zeus.json dosyanızın, test_console olarak adlandırdığım test ortamında çalışacak yeni bir konsol komutunu içerecek şekilde değiştirerek gerçekleştirilir.

{ 
    "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"] 
     } 
     } 
    } 
    } 
} 

Eğer custom_plan özel bir planı oluşturmak gerekir, ancak test_console etkinleştirmek için:

İşte benim bütün zeus.json dosya, "test_console" ile başlayan parçası olmak sadece ilgili biraz .rb dosya, aşağıdaki gibi:

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 

Not default_bundle_with_test_env gereklidir, yukarıda tanımlanan test_console yöntemi olduğu gibi zeus.json dosyanızda. Nihayet

, çalıştırın: zeus test_console veya zeus tc

İlgili konular