# spec/requests/root_request_spec.rb# encoding: utf-8 require'spec_helper'describe"AdminSessions"dodeflogin_with(admin_login,admin_password)post"/admin_session",:admin_session=>{:login=>admin_login,:password=>admin_password}enddescribe"GET /"doit"should redirect to login page"doget"/"response.shouldredirect_to(new_admin_session_path)getnew_admin_session_pathresponse.shouldcontain("你还没有登录,请先登录")endit"should not redirect to loign page if logged"docurrent_admin=Factory("actived_admin")login_with("actived_admin","actived_admin")response.shouldredirect_to(root_path)get"/"response.shouldbe_successresponse.shouldcontain("登录成功!")endit"should show error info with wrong loign id"docurrent_admin=Factory("actived_admin")login_with("actived_admin","adminpassword_error")response.shouldcontain("你输入的帐号或密码不正确!")endendend