]> git.openstreetmap.org Git - rails.git/blob - test/system/profile_company_change_test.rb
Add frozen_string_literal comments to ruby files
[rails.git] / test / system / profile_company_change_test.rb
1 # frozen_string_literal: true
2
3 require "application_system_test_case"
4
5 class ProfileCompanyChangeTest < ApplicationSystemTestCase
6   test "can't change company when unauthorized" do
7     user = create(:user)
8
9     visit user_path(user)
10
11     within_content_body do
12       assert_no_button "Edit Profile Details"
13       assert_no_link "Edit Company"
14     end
15   end
16
17   test "can't change company of another user" do
18     user = create(:user)
19     another_user = create(:user)
20
21     sign_in_as(user)
22     visit user_path(another_user)
23
24     within_content_body do
25       assert_no_button "Edit Profile Details"
26       assert_no_link "Edit Company"
27     end
28   end
29
30   test "can change company" do
31     user = create(:user)
32
33     sign_in_as(user)
34     visit user_path(user)
35
36     within_content_body do
37       click_on "Edit Profile Details"
38       click_on "Edit Company"
39       fill_in "Company", :with => "Test Co."
40       click_on "Update Profile"
41     end
42
43     assert_text "Profile company updated."
44
45     within_content_body do
46       assert_text :all, "Company Test Co."
47
48       click_on "Edit Profile Details"
49       click_on "Edit Company"
50       fill_in "Company", :with => "Test More Co."
51       click_on "Update Profile"
52     end
53
54     assert_text "Profile company updated."
55
56     within_content_body do
57       assert_text :all, "Company Test More Co."
58     end
59   end
60 end