]> git.openstreetmap.org Git - rails.git/blob - test/controllers/profiles/locations_controller_test.rb
Add empty profile location page
[rails.git] / test / controllers / profiles / locations_controller_test.rb
1 require "test_helper"
2
3 module Profiles
4   class LocationsControllerTest < ActionDispatch::IntegrationTest
5     ##
6     # test all routes which lead to this controller
7     def test_routes
8       assert_routing(
9         { :path => "/profile/location", :method => :get },
10         { :controller => "profiles/locations", :action => "show" }
11       )
12       assert_routing(
13         { :path => "/profile/location", :method => :put },
14         { :controller => "profiles/locations", :action => "update" }
15       )
16     end
17
18     def test_show
19       user = create(:user)
20       session_for(user)
21
22       get profile_location_path
23
24       assert_response :success
25       assert_template :show
26     end
27
28     def test_show_unauthorized
29       get profile_location_path
30
31       assert_redirected_to login_path(:referer => profile_location_path)
32     end
33   end
34 end