1
我尝试使用RailsGuides中的代码和我在Google上找到的其他代码,但没有任何工作。如何在Rails 3中进行集成测试?
如何在使用Test :: Unit的Rails 3中进行简单的集成测试?你如何让这个会话在HTTP请求中持续存在?
以下代码失败,因为Expected response to be a <:success>, but was <302>
。我认为这是因为发布请求后会话丢失。
class UserFlowsTest < ActionDispatch::IntegrationTest
fixtures :all
test "client can get client dashboard" do
post '/login', :login=> users(:client).login, :password => 'thepassword'
get '/dash'
assert_response :success
end
end
Working in Rails 3.07。
谢谢。
你可以发布你的控制器的代码? – rdvdijk