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