Ruby on Rails - Test Unit -


i have test :

test "should not allow access"     :new     assert_redirected_to new_user_session_url  end 

i use devise authentication.

i have 2 views each of actions: 1 normal, , 1 mobile devices, before i've used usual default view (sign_in.html.erb) - test pass, when i've added mobile view (sign_in.mobile.erb) i've got next fail message.

expected response redirect http://test.host/users/sign_in redirect http://test.host/users/sign_in.mobile

so client testing point of view - logic working fine, e.g. in case if user not authenticated redirected session new path (new_user_session_url). works mobile devices (mobile client redirected mobile view of sign in page), test fail reasons if client mobile device , controller redirect mobile view.

my question how fix test ? i've tried :

assert_redirected_to new_user_session_path  assert_redirected_to :controller => "devise/session", :action => "new" 

but no success , same fail message in case if client mobile device , redirect happens mobile view.

any thoughts ?

assert_redirected_to new_user_session_path(:format => 'mobile') 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -