Co chcę zrobić, to uruchomić rails console test
ale Zeus klejnot, coś takiego: zeus console test
Jak uruchomić konsolę Rails w środowisku testowym ze Zeusem?
dziękuję z góry!
Co chcę zrobić, to uruchomić rails console test
ale Zeus klejnot, coś takiego: zeus console test
Jak uruchomić konsolę Rails w środowisku testowym ze Zeusem?
dziękuję z góry!
Rozwiązanie osiąga się, modyfikując plik zeus.json tak, aby zawierał nowe polecenie konsoli, które będzie działać w środowisku testowym, które nazwałem test_console
.
Oto cała moja zeus.json plik, jedynym istotnym nieco będąc częścią zaczynając "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"]
}
}
}
}
}
Aby włączyć test_console jednak trzeba będzie stworzyć plan niestandardowy w swojej custom_plan .rb plików, jak następuje:
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
Uwaga default_bundle_with_test_env jest potrzebne, ponieważ jest to metoda test_console które zdefiniowano powyżej w pliku zeus.json.
Na koniec uruchom: zeus test_console
lub zeus tc