0
應用程序應該根據瀏覽器設置設置區域設置,但我不知道如何測試它。我不知道我能提供什麼樣的代碼示例來解釋,但測試是這樣的:在rails功能測試中發送瀏覽器字符串
def test_locale_settings
get :index, {}, {:user_id => 1} # send browser settings to english
assert_select '.nav .welcome', :text => 'Welcome'
get :index, {}, {:user_id => 1} # send browser settings to spanish
assert_select '.nav .welcome', :text => 'Bienvenido'
end
是的,我不得不把兩個方塊放在不同的方法中,因爲它沒有反映sencond =/..但那就是訣竅。謝謝。 – grilix 2011-02-08 21:43:15