Functional Testing

Hi all,

I am new in Testing I want to test my oauth controller which is using
facebook login and callback I want to prepare the test case for that

and

home controller contains

class HomeController < ApplicationController
layout ‘home’,:only=>[“new”]

before_filter :authenticate_user!, :only=>['new']

def index
  redirect_to home_path if current_user
end

#This method display for all type of videos in home page
def new
  #render :index
  @videos,@prev,@next= params[:page] ?

Video.display_videos(params[:page].to_i) : Video.display_videos

end

end

which uses devise I have written the test case like this

include Devise::TestHelpers

test "set up " do
@controller = HomeController.new
@request= ActionController::TestRequest.new
@response= ActionController::TestResponse.new
end

test " Test Index Method" do
get :index
assert_response :success
assert_nil assigns(:home)

 assert_tag :tag => 'div',
      :attributes => { :class => 'w1' }

 assert_response 200
assert_template 'home/index'     # test that the correct view file

would be rendered

end

test "testing routes " do
assert_routing “home”, { :controller => ‘home’,:action =>
‘new’ } # assert_routing lets you test the routes defined in config/
routes.rb
end

test " Test new Method " do
get :new
assert_response 302, @response.body

end

but unable to write the test case for redirect

any one’s help is accepted please help me

Thanks in advance and for ever…