-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from hathitrust/editable_contact
Make contact editable
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,6 +268,22 @@ class HTInstitutionsControllerEditTest < ActionDispatch::IntegrationTest | |
assert_equal new_status, HTInstitution.find(inst.inst_id).emergency_status | ||
end | ||
|
||
test 'Can update emergency contact' do | ||
new_contact = '[email protected]' | ||
inst = create(:ht_institution, emergency_contact: '[email protected]') | ||
|
||
patch ht_institution_url inst, params: {'ht_institution' => {'emergency_contact' => new_contact}} | ||
|
||
assert_response :redirect | ||
assert_equal 'update', @controller.action_name | ||
assert_not_empty flash[:notice] | ||
assert_redirected_to ht_institution_path(inst) | ||
follow_redirect! | ||
|
||
assert_match new_contact, @response.body | ||
assert_equal new_contact, HTInstitution.find(inst.inst_id).emergency_contact | ||
end | ||
|
||
test 'Blank emergency status sets null' do | ||
inst = create(:ht_institution, emergency_status: '^(member)@university.invalid') | ||
patch ht_institution_url inst, params: {'ht_institution' => {'emergency_status' => ''}} | ||
|