1 # frozen_string_literal: true
3 require "application_system_test_case"
5 class ProfileCompanyChangeTest < ApplicationSystemTestCase
6 test "can't change company when unauthorized" do
11 within_content_body do
12 assert_no_button "Edit Profile Details"
13 assert_no_link "Edit Company"
17 test "can't change company of another user" do
19 another_user = create(:user)
22 visit user_path(another_user)
24 within_content_body do
25 assert_no_button "Edit Profile Details"
26 assert_no_link "Edit Company"
30 test "can change company" do
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"
43 assert_text "Profile company updated."
45 within_content_body do
46 assert_text :all, "Company Test Co."
48 click_on "Edit Profile Details"
49 click_on "Edit Company"
50 fill_in "Company", :with => "Test More Co."
51 click_on "Update Profile"
54 assert_text "Profile company updated."
56 within_content_body do
57 assert_text :all, "Company Test More Co."