0
在我當前的代碼中,我已經在運行每個規範之前執行了visit 'root'
和login
命令。我如何才能讓它執行一次,以便加速測試?目前爲了解決這個問題,我在一個規格中增加了幾個規格。如何讓前鉤執行一次?
這也是客戶端的JS應用程序,所以應用程序必須建立在每次訪問調用。登錄可能也很慢。一旦應用程序加載,其餘的可以真的很快。
feature "Edit Project Page" do
context "logged in user with one project" do
# would like this to execute once for the context
before() do
visit root_path # slow, whole app has to rebuild
login_user # also slow
sleep 1
@user_id = user_id()
create_project
end
scenario "foo" do
#...
page.should have_content "foo"
end
scenario "bar" do
#...
page.should have_content "bar"
end
end
end