4 class LinksControllerTest < ActionDispatch::IntegrationTest
6 # test all routes which lead to this controller
9 { :path => "/profile/links", :method => :get },
10 { :controller => "profiles/links", :action => "show" }
13 { :path => "/profile/links", :method => :put },
14 { :controller => "profiles/links", :action => "update" }
22 get profile_links_path
24 assert_response :success
28 def test_show_unauthorized
29 get profile_links_path
31 assert_redirected_to login_path(:referer => profile_links_path)
38 put profile_links_path, :params => { :user => { :social_links_attributes => [{ :url => "https://test.com/test" }] } }
40 assert_redirected_to user_path(user)
42 assert_response :success
44 assert_dom ".alert-success", :text => "Profile links updated."
45 assert_dom "a", "test.com/test"
48 def test_update_empty_social_link
52 put profile_links_path, :params => { :user => { :social_links_attributes => [{ :url => "" }] } }
54 assert_response :success
56 assert_dom ".alert-danger", :text => "Couldn't update profile links."