1 # frozen_string_literal: true
 
   6   class CompaniesControllerTest < ActionDispatch::IntegrationTest
 
   8     # test all routes which lead to this controller
 
  11         { :path => "/profile/company", :method => :get },
 
  12         { :controller => "profiles/companies", :action => "show" }
 
  15         { :path => "/profile/company", :method => :put },
 
  16         { :controller => "profiles/companies", :action => "update" }
 
  24       get profile_company_path
 
  26       assert_response :success
 
  30     def test_show_unauthorized
 
  31       get profile_company_path
 
  33       assert_redirected_to login_path(:referer => profile_company_path)
 
  40       put profile_company_path, :params => { :user => { :company => "new company", :description => user.description } }
 
  42       assert_redirected_to user_path(user)
 
  44       assert_response :success
 
  46       assert_dom ".alert-success", :text => "Profile company updated."
 
  49       assert_equal "new company", user.company